parseint not defined for char.

2022-03-29 Thread Araq
@cblacke My point was that among "uni-typed" systems there can still be a big difference between structured and unstructured data. "everything is a stream of bytes" is as unstructured as it can get so naturally quoting rules become important.

parseint not defined for char.

2022-03-29 Thread cagyul
Thanks, this is much appreciated. I am starting to get it now

parseint not defined for char.

2022-03-29 Thread cblake
What Araq says is very fair in practice, but maybe requires clarification in theory. Quoting rule complexity is not intrinsic to the command language problem (which might almost be defined as "everything is a string literal but without quotes unless they are 'necessary', whatever that means"). A

parseint not defined for char.

2022-03-29 Thread Zoom
> perfectly tailored educational content [...], culminating in "programming by > StackOverflow copy-paste" I think you're making a big leap here, I don't think these two facts are related really. > Specifically, the Gutenberg Bible revolutionized literacy in Medieval Europe. I knew that compar

parseint not defined for char.

2022-03-29 Thread Araq
> This is roughly how "Unix shells" and other command languages like Tcl and > command.com work. Any "unitype-driven" system has all the same issues as an > "everything is a PyObject" system, for all the same reasons. There is actually a big difference between Unix shells and the PyObject system

parseint not defined for char.

2022-03-28 Thread Araq
Nah, read Sedgewick first. ;-) > But I still don't know what static type I should use to replace strings > (pre-defined arrays of characters ?). type Filename = distinct string Displayname = distinct string Option = enum ... Options = set[Option]

parseint not defined for char.

2022-03-28 Thread cagyul
Thank you for your comments. I have just read Harper and it helps in understanding the theoretical side of the matter. But I still don't know what static type I should use to replace strings (pre-defined arrays of characters ?). I have Sedwick (Pascal examples) and will re-consult it but only af

parseint not defined for char.

2022-03-28 Thread cblake
> you don't start learning to read with the Bible I don't really disagree, but would add that I think this phrasing speaks to the modern age of perfectly tailored educational content which has us all somewhat spoiled, culminating in "programming by StackOverflow copy-paste". Specifically, the G

parseint not defined for char.

2022-03-28 Thread cagyul
"As your programs grow bigger, avoid the string datatype. string indicates a lack of structure, it's effectively dynamically typed code. Use the static type system to the best of your abilities." Another example of a simple sentence that, as an amateur (beginner) programmer will have me scratch

parseint not defined for char.

2022-03-28 Thread Araq
> Also, Java. I have some of the earlier editions where the code examples are in Pascal. :-)

parseint not defined for char.

2022-03-28 Thread Zoom
> Let me give you some advice about how to learn programming: > > 1. Read books about algorithms. I can recommend anything written by > Sedgewick. > Wow, you have high standards. Sedwick's "Algorithms" is an important and required book for anyone doing programming, but I wouldn't suggest it

parseint not defined for char.

2022-03-28 Thread Araq
> All great points (although I'm not entirely sure what you have against PEGs), For beginners PEGs are much like regexes: 1. "Language in a language" problem: The syntax is not like Nim's and you would be learning two languages at the same time. 2. Either not powerful enough to do any real p

parseint not defined for char.

2022-03-28 Thread Stefan_Salewski
> Again if nim is not meant for beginners please advertise as such and not let > poor fools Have you already asked Google about a Nim beginner book, and maybe considered reading it? There is a section about "Integer to string conversion" which explains a lot. It is not parseInt(), but the oppos

parseint not defined for char.

2022-03-28 Thread PMunch
All great points (although I'm not entirely sure what you have against PEGs), but even as an experienced programmer both in Nim and other languages I do sometimes want to just have the fish handed to me. Having a `parseInt` overload for char which just does the `ord` trick Yardanico showed (mayb

parseint not defined for char.

2022-03-28 Thread Araq
Let me give you some advice about how to learn programming: 1. Read books about algorithms. I can recommend anything written by Sedgewick. 2. Program "find substring" in the language you want to learn. Don't avoid this exercise because the language's library already offers it -- the point is

parseint not defined for char.

2022-03-28 Thread enthus1ast
Imho it does not hurt to add it either

parseint not defined for char.

2022-03-27 Thread xigoi
`parseInt` would be a misleading name, since you're not parsing anything.

parseint not defined for char.

2022-03-27 Thread ElegantBeef
> I would also be completely fine with it if my experience improved the > experience of future programmers like me The best way to have this happen is to document your issues formally in a pull request to update the docs. It's not as concrete as the forum but the real time Nim chat is generally

parseint not defined for char.

2022-03-27 Thread solomonthewise
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'

parseint not defined for char.

2022-03-27 Thread Yardanico
I'd say it's much less useful, especially considering that 1-char "numbers" are just single digits, so you can get a number from an ASCII character easily: echo ord('5') - ord('0') Run

parseint not defined for char.

2022-03-27 Thread solomonthewise
is there a reason why its not provided in the std/library. It would seem just as useful as the original?

parseint not defined for char.

2022-03-27 Thread huantian
You're correct, there is no `parseInt` for char, you can do what you're doing and convert the chars to strings, or just make a custom version which switch cases over the allowed chars.

parseint not defined for char.

2022-03-27 Thread solomonthewise
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).