@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.
Thanks, this is much appreciated. I am starting to get it now
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
> 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
> 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
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]
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
> 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
"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
> Also, Java.
I have some of the earlier editions where the code examples are in Pascal. :-)
> 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
> 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
> 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
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
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
Imho it does not hurt to add it either
`parseInt` would be a misleading name, since you're not parsing anything.
> 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
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'
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
is there a reason why its not provided in the std/library. It would seem just
as useful as the original?
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.
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).
23 matches
Mail list logo