the second one is pretty much what I proposed just feels lacking a few
features. I kinda feel it would need to be implemented at a language level to
be powerful. thanks for sharing
Just had this thought on my mind and am curious what others think. quick note,
even if this is actually a good idea it might be impossible to implement in a
reasonable time frame. Both null and Error occur when we get a value we do not
want and we have to choose how to handle it. Oftentimes the
building a lisp. the code was as follows.
MalType* = object
case mk*: Mk
of mklist: lis*: seq[MalType]
of mkint: intval: int
of mkstring: strval: string
of mkfloat: floatval: float
of mkbool: boolval: bool
Run
because of the r
thanks so much for the detailed reply. I was mainly worried about the recursive
aspects since the type has a field seq[itself] as well as it being arbitrarily
long (since its a ast).
that makes sense. :) thank you
thanks so much. what do you mean by direct recursion?
this is my current code it runs but im wondering if it would scale badly or
have weird behaviors.
MalType* = object
case mk*: Mk
of mklist: lis*: seq[MalType]
of mkint: intval: int etc
Run
compared to this
MalType* = ref object
Thanks
I have a type defined as follows.
Lis* = ref seq[MalType] not nil
Run
but when I try to initialize it like this
x: Lis = @[] #or
x: Lis[] = @[]
Run
i get a error
better sum types. default no nill but can be added explicitly(either with
option or regular NIL). strict funcs default. BATTERIES INCLUDED. good
libraries should become part of the std/library once support can be promised.
being part of std/library feels like a guarantee that the library is
mai
I don't mean to sound catty when I say this but is nim not meant for beginner
programmers as well? this is something I struggled with while learning nim. the
solution I eventually found was to turn it in to a string using $. However this
was not immediately obvious for me how to do. I also didn'
is there a reason why its not provided in the std/library. It would seem just
as useful as the original?
this could just be a me mistake where I can't find the equivalent in the
std/library for parseint on char. this code returns a error though. echo
"123456".reversed.map(parseInt) while this code does what it is supposed to.
echo "123456".reversed.mapIt($it).map(parseInt).
top_row and (b.mask + (1 shl (7 * row))) == 0 gives a error while (top_row and
(b.mask + (1 shl (7 * row == 0 gives the result I want. notice that b.mask
is a int64 and so is top_row. I think I know why this occurs. since with the
brackets and becomes binary and, then without the brackets it
I defined a type called int_b = int64 and defined a specific print format for
it using $. It works within the module its defined in however when I attempt to
print a int_b in another module I get this error message. I made sure to add
the * so it would import. I'm likely making a stupid mistake
thanks, I still haven't figured out generics yet so this is very helpful. I'm
wondering why this isn't the standard behavior for enums though. Every single
time I've created a enum I've wanted it it wrap
I was working on a connect 4 app and I created a enum called player. with two
different values. I want the ability to easy swap the value of player using
inc(p) but when I do that I get a overflow error. This makes enums a lot less
useful for me. Is there a way to have a enum type that wraps bac
17 matches
Mail list logo