htmlparser was written before there was a standard that explained how to repair
broken HTML and most HTML out there is broken.
\---Code Update---
The code below has a working version now and able to find my links. But
still... what could be going on with that parseHtml() proc?
import httpclient, nimquery, xmltree, htmlparser, strtabs, strutils
proc googleSearchQuery(query :string,results :int
Dude this is awesome! I'll be adding my stuff soon!
Hey guys,
I think the parseHtml() proc in the htmlparser module may have a bug in it. So
I'm building a web crawler for scraping the Organic results in a Google Search
Results Page and I ran into an issue sometimes when scraping. Example (for
those of you in the United States at least), if you
docs.nim.town gives me a 404.
People get misled by these toy examples with object hierarchies where the only
operation being done is `echo`. `echo` implicitly applies `` $ `` to all of its
arguments. Where's your `$` methods for `TextDoc` and `TodoDoc`? I don't see
them anywhere, and neither does the compiler, so it applies
First of all thanks to OP redditor and everyone else for this thread. I have
been curious about Nim for a long time and interested in its balance of great
features, nice syntax and maybe some rough edges.
Please forgive my completely uninformed participation, as someone entirely new
to Nim, but
The compiler can infer the kind through flow analysis, and my understanding is
that it does ... the docs imply that, anyway.
Yeah, it's by Dm Knight from our Telegram chat :)
[https://www.parrotsec.org/blog/parrot-4.10-release-notes](https://www.parrotsec.org/blog/parrot-4.10-release-notes)/
What about the object variant safety issue?
type
DocKind = enum
text,
todo
Doc = object
case kind: DocKind
of text:
text: string
of todo:
todo: string
let doc = Doc(kind: text, text: "some doc")
Thank you very much i'll give that a try. I was originally trying to make a
change like that by forking the compiler -- i never thought of using `include`
that way. Definitely a nicer way of doing it (albeit probably will be broken at
some point). Very neat!
That does look simpler :)
* * *
import osproc
let (outp, errC) = execCmdEx("makepkg --printsrcinfo")
echo "outp = ", outp, "nerrC = ", errC
Tried the `osproc` module too? I see no need for your Posix specific code.
woah! ascii.town is really cool, haven't seen that one before
Thanks! Yes, I updated note about JSON.
doc.nim.town, docs.nim.town, doc.nim.land, docs.nim.land, all redirect to the
nim documentation page now
Awesome! Reminds me of [https://ascii.town/](https://ascii.town/). Maybe a
project to have the same thing written in Nim is in order? :D
This works in Nim 1.2.6 but not in 1.3.5 and it behaves in an apparently
illogical way. It's a simplified standalone example from Pakku, the actual
option to makepkg causing the problem is --printsrcinfo but --version does the
same. Perplexingly, -V does work. And running just the exec part work
Please see my comment on that stackoverflow answer as well as your thread on
this forum.
That Stackoverflow answer is 6 years old at this point, things change. Although
I would say that even then it wasn't a correct answer. Please downvote it
accordingly.
It does not propose to generate JSON manually:
import json
type
Person = object
name: string
age: Natural
let a = Person(name: "Someone", age: 18)
echo %*a
Run
oh! good idea! apologies for the late response, yes, i can set that up
Also, about the json \- I may be missing something, but it proposes to manually
generate JSON. That's not a good option, JSON should be generated automatically.
You may need some tools to alter the default behaviour of Object to JSON
conversion and fine-tune it, but the default behaviour should
Hmm, I understand what you are saying, but seems like people still use marshal
for JSON conversion, and this StackOverflow question has the most votes on
using marhsal :)
[https://stackoverflow.com/questions/26191114/how-to-convert-object-to-json-in-nim](https://stackoverflow.com/questions/26191
Reposted from Reddit:
Hi, thanks for answering my questions for a week, while I studied Nim.
I wrote the second version of my feedback about using Nim
[http://al6x.com/blog/2020/nim-language](http://al6x.com/blog/2020/nim-language)
I wrote it for myself as a note to check Nim against it in a co
Some of my comments:
> "The standard library Nim documentation suggest us to generate JSON by hand
> with JsonNode . And we absolutelly not going to do that, nobody generates
> JSON by hand these days. Not good, when official docs promoting inconvenient
> way to do things."
Marshal shouldn't b
Great tip @spip! I had a look at
[NimData](https://github.com/bluenote10/NimData) and it seems to be pretty
suitable.
I agree, it would make it easier for people new to Nim to see that there is a
Science community here. Right now you have to be lucky to find it basically :P
Pretty cool! Norm has a new home at
[https://norm.nim.town](https://norm.nim.town) now.
You can trust the compiler a bit more. If you follow along with
[http://zevv.nl/nim-memory/#_lets_talk_about_seqs](http://zevv.nl/nim-memory/#_lets_talk_about_seqs)
and use that technique to look under the hood of an empty seq, youll see it's
a nil pointer until you add data
So really, just use
Can we have docs.nim.town redirect to
[https://nim-lang.org/documentation.html](https://nim-lang.org/documentation.html)?
There are also `uncheckedArray`. See here:
[https://nim-lang.github.io/Nim/manual.html#types-unchecked-arrays](https://nim-lang.github.io/Nim/manual.html#types-unchecked-arrays)
Hey, the comparison with Typescript is quite enlightening! Thanks. :-)
Nice idea! I've sent you a request for norm.nim.town.
The value "nothing" does not really exist in computer science. Of course in C
we have NULL and in Nim we have nil for ref and pointer types. NULL and nil are
special well defined values, often binary zero, which have a special meaning by
definition: The absence of a value.
In Nim we have the se
OK, let's say I have a array-type variable.
Is it possible to set it to... nothing?
I mean let's say a function takes an array parameter, with some (or no) values.
I could obviously declare it as a seq, but then we would deal with memory
allocation. I can also declare it as an openArray, and th
since you know pandas, the answer depends on the definition of "comprehensive":
the kind of data file, operations. No one can suggest if the conditions are
missing.
And, I believe that, there is no library which can compete against pandas for
static language
We have a budding community of people building Nim library for science over
here:
* [https://gitter.im/SciNim/community](https://gitter.im/SciNim/community)
I think it would be worthwhile to bridge with a corresponding channel on
Discord and IRC as it already has some regular activity.
Use Nim's type system.
type
Keys = enum
key1, key2
Value = object
param1: string
param2: int
const
table = array[Keys, Value] = [
key1: Value(param1: "a string", param2: 100),
key2: Value(param1: "another string
OK, this is not so important, but I still thing I'm missing something.
I want to create a **const** table (meaning: only for compile-time, in order to
have things better organised). It's like that:
const
TABLE = {
"key1" : {
"param1": "a string
40 matches
Mail list logo