Re: Why Seq search is faster than Table search

2020-07-06 Thread miran
> I faced aggression and sarcasm

I can assure you that was just a plain sarcasm without even a slightest bit of 
aggression.

> I didn't accuse anybody

...except now on the forum, when you accused others for aggression because you 
didn't get/like their humor.

> I didn't said that hash maps useless

I quote your exact comment: " Than why we need tables if array search 
faster?"


Re: Is there a command line one-line to start an HTTP server using Nim?

2020-07-06 Thread miran
> So the correct fix is:
> 
> 1\. Cut a new release of the zip nimble package

After three years, there is now a new `zip` version :)

`zip` is now at version 0.3.0, and it contains some recent changes, with the 
biggest one being this PR: 
[https://github.com/nim-lang/zip/pull/60](https://github.com/nim-lang/zip/pull/60)


New blog post: Ray tracing in Nim

2020-06-30 Thread miran
Guest post by @mratsim: 
[https://nim-lang.org/blog/2020/06/30/ray-tracing-in-nim.html](https://nim-lang.org/blog/2020/06/30/ray-tracing-in-nim.html)


Re: Can't install the bin tarball of nim 1.2.2.

2020-06-27 Thread miran
We have just released Nim 1.2.4 — it is a hotfix release which deals with the 
`nim-gdb` problem mentioned in this thread.


Re: Nim version 1.2.2 is out!

2020-06-27 Thread miran
We have just released Nim 1.2.4 — it is a hotfix release which deals with the 
`nim-gdb` problem mentioned in [this thread](https://forum.nim-lang.org/t/6460).

The complete changelog is available 
[here](https://github.com/nim-lang/Nim/compare/v1.2.2...v1.2.4).


Re: Idea: Nim Online Conference

2020-06-21 Thread miran
NimConf 2020 was streamed yesterday, and IMO it was a great success!

It was the first time for us doing such a thing, and it went quite smoothly. 
There are some details we would like to improve for NimConf 2021, for which we 
are hoping it will be even better — if you have a feedback about NimConf 2020, 
we would like to hear it!

We would like to thank all of our presenters for coming up with the interesting 
topics, recording the videos, and for answering all the questions that came up 
during the live chat with the audience.

Also thanks to all who participated as live audience! We hope you had fun 
watching the talks and interacting with the authors, and learned something new 
about Nim, its libraries and cool projects.

* * *

If you have missed any of the talks, the whole conference (15 talks!) is 
available for later watching in our [NimConf 2020 
playlist](https://www.youtube.com/playlist?list=PLxLdEZg8DRwTIEzUpfaIcBqhsj09mLWHx).


Re: When will the NimConf timeline get posted?

2020-06-19 Thread miran
> The time schedule for the talks can now be found at 
> [https://conf.nim-lang.org](https://conf.nim-lang.org)

And you can now directly see the [NimConf 2020 youtube 
playlist](https://www.youtube.com/playlist?list=PLxLdEZg8DRwTIEzUpfaIcBqhsj09mLWHx)
 where you can click on 'set reminder' for the videos you would like to be 
notified before they air.


Re: Idea: Nim Online Conference

2020-06-19 Thread miran
The time schedule for the talks can now be found at 
[https://conf.nim-lang.org](https://conf.nim-lang.org)

And you can now directly see the [NimConf 2020 youtube 
playlist](https://www.youtube.com/playlist?list=PLxLdEZg8DRwTIEzUpfaIcBqhsj09mLWHx)
 where you can click on 'set reminder' for the videos you would like to be 
notified before they air.


Nim version 1.2.2 is out!

2020-06-17 Thread miran
This is the first patch release for Nim 1.2, you can read more about it here: 
[https://nim-lang.org/blog/2020/06/17/version-122-released.html](https://nim-lang.org/blog/2020/06/17/version-122-released.html)


Re: New entry on Nim blog...

2020-06-10 Thread miran
> I didn't see a post

The post was in the making, but you were faster than me ;)

Thanks for posting it here, and thanks to @moerm for writing it!


Re: Using a Table as an object's member.

2020-06-07 Thread miran
> `proc add(this: JotzCollection, name: string, note: string)`

`this` must be a `var` if you want to modify it:

`proc add(this: var JotzCollection, name: string, note: string)`


Re: Module level variables in plugin libraries

2020-06-04 Thread miran
> or at least 1.2.2 beta release which has most ARC fixes backported from devel

There's a newer 1.2.2-beta with even more bugfixes: 
[https://github.com/nim-lang/nightlies/releases/tag/2020-06-01-version-1-2-5702a60](https://github.com/nim-lang/nightlies/releases/tag/2020-06-01-version-1-2-5702a60)


Re: Idea: Nim Online Conference

2020-05-29 Thread miran
> submissions deadline: May 31st

Just two more days to submit your talks!!


Re: proposal: PTAL tag to make it clear that a PR is ready again for review

2020-05-17 Thread miran
> Please no.

+1

> All these title/tag changes are just noise and we've got enough of that 
> already.

+1

> just ping the best person to review that PR

Or, better yet, don't ping anybody and just be patient.

At the time of writing this, we have 114 open PRs (and that's after two weeks 
of constant merging as fast as possible! The number was much higher last 
month.), and it should be obvious to anybody following Nim's github repo that 
we have very hard time reviewing and merging them in reasonable time.

One person pinging and/or PTAL-ing (which already happens), just gives an 
impression "look at my stuff, my stuff is more important than all the other 
stuff by all the other contributors". NO!

@timothee If you really want to help us with faster merging of PRs, take a look 
at those 40 out of 114 (35%!) open PRs which are authored by you. Are all of 
them really important (for larger Nim audience, not just for your workflow)? 
How can we review PRs in time if you're constantly flooding us with new stuff?

Long story short: new flags or constant pings don't help with faster reviews. 
Less "privatization" of Nim repo will.


Re: Idea: Nim Online Conference

2020-05-16 Thread miran
> The conference time (or at least timezone to get an idea) is rather important 
> because depending on your timezone the conference could effectively be on 
> another date.

The registration form currently says: _Proposed start at 11 a.m. UTC_.

That should give you a rough idea about when can you expect the talks to 
happen. (The exact timeline and other details will be announced after the 
registration deadline)


Re: Idea: Nim Online Conference

2020-05-14 Thread miran
> Until when can we procrastinate with talk submissions?

We've decided to move everything back for 2 weeks — it gives you more time to 
procrasahem prepare your talks :)

  * submissions deadline: May 24th
  * conference date: June 20th



See the blog post for more details: 
[https://nim-lang.org/blog/2020/05/14/nim-conference.html](https://nim-lang.org/blog/2020/05/14/nim-conference.html)


Re: rerunning CI works for github actions, sr.ht, but not azure pipelines

2020-05-14 Thread miran
I don't understand. Restarting just failed checks on Azure Pipelines works for 
me.


Re: Having problems porting a Python script for computing two cofactors of a number

2020-05-13 Thread miran
> As far as I can see one of the issues if that there's an overflow when two 
> big uint64's are multiplied.

Since after the multiplication you're taking a modulo, [these examples of 
modular 
arithmetic](https://en.wikipedia.org/wiki/Modular_arithmetic#Example_implementations)
 might come useful.


Re: Idea: Nim Online Conference

2020-05-07 Thread miran
Just a reminder that Nim Online Conference is just a month away — Saturday, 
June 6th.

[Submit your talk!](https://forms.gle/6TKMiRZ2bP5DyUyZA)


Re: Idea: Nim Online Conference

2020-04-27 Thread miran
Also, if you would like to give more than one talk, that is entirely possible — 
just fill [the form](https://forms.gle/6TKMiRZ2bP5DyUyZA) multiple times.


Re: Idea: Nim Online Conference

2020-04-18 Thread miran
> Until when can we procrastinate with talk submissions?

The deadline in on May 15th.


Re: I think we can really do better...

2020-04-17 Thread miran
@other_mods: Guys, didn't you notice that @brianwil2727 has put one link to 
some Bitcoin stuff to his post? It is a well-masked spam.


Re: Idea: Nim Online Conference

2020-04-16 Thread miran
Applications are now officially open, please register via [this 
form](https://forms.gle/6TKMiRZ2bP5DyUyZA).


Re: 1.2.0 build.sh error : OpenBSD AMD64

2020-04-08 Thread miran
> I'm not sure if it is in 1.2

It is.


Re: Accessing global variable inside proc results in Error: undeclared identifier

2020-04-08 Thread miran
> coming from python i am new to Nim
> 
> What am i doing wrong?

Defining `opts` after your proc? (You can do that in Python, but not in Nim)


Re: Nested list comprehension

2020-03-06 Thread miran
> The documentation of Seq & Tables are very poor in Nim. Not many examples to 
> learn from.

If something has a solid documentation and lots of examples, then it is 
`tables` module. :rolleyes:


Re: Nested list comprehension

2020-03-06 Thread miran
> I tried with...
> 
> [invalid syntax]

If you really want to force list comprehensions, how about you first get 
familiar with the correct Nim syntax for them? 
[link](https://nim-lang.org/docs/sugar.html#\[\].m%2CListComprehension%2Cuntyped%2Cuntyped)

But my advice would be: don't use list comprehensions in Nim — think about how 
would you have written your python code without them and then try to translate 
_that_ version, you'll have much better time.


Re: Performance test agains Python

2020-03-06 Thread miran
> `#Compile: nim --passc:-flto --opt:size c test.nim`

Use `-d:release` and try again, please.


Re: Nested list comprehension

2020-03-03 Thread miran
There are few problems with your Nim version, e.g. returning `string` instead 
of `seq[string]` (cause this is what the Python version does - it returns a 
list).

Here is a correct Nim version: 


proc cross(xs, ys: string): seq[string] =
  ## Cross product of elements in A and elements in B.
  for x in xs:
for y in ys:
  result.add x


Run


Re: do we need travis+appveyor in nim repo now that we have azure-pipelines?

2020-03-03 Thread miran
> and it translates in a badge saying build failing or passing on 
> [https://github.com/nim-lang/Nim](https://github.com/nim-lang/Nim)

Nothing has been pushed after I disabled Travis. So don't jump to conclusions 
just yet.


Re: do we need travis+appveyor in nim repo now that we have azure-pipelines?

2020-03-02 Thread miran
Yes, we'll remove those.


Re: Is this a bug or just unallowed naming?

2020-02-25 Thread miran
> I know I can change the file name to resolve the problem

Or, more pragmatically, you change the name of the type to `Foo` (uppercase 
`F`), as that is the idiomatic Nim.


Re: Modify old code using new/finalizer to compile with gc:arc

2020-02-23 Thread miran
> when compileOption("gc", "arc") seems not to compile at all for old stable 
> Nim.

Wrap everything related to `arc` in the version check, e.g.:


when (NimMajor, NimMinor) >= (1, 1):
  when compileOption("gc", "arc"):
 


Run


Re: Nim Community Survey 2019

2020-02-20 Thread miran
> any chance to re-open?

Nope. The survey is over.

* * *

> One thing I wanted to mention, is that the pair of "no" answers in "Have you 
> made contributions" was a very weird choice
> 
> (...)
> 
> I had the exact same reaction as akavel regarding the "Have you made 
> contributions?“ question.
> 
> (...)
> 
> Me too. Is opening an issue a contribution? Is writing a library a 
> contribution?

Thanks for the feedback! We'll try to keep that in mind for the 2020 survey.


Re: I have a super doubt

2020-02-19 Thread miran
> nim as the first programming language that I am learning which books or 
> manuals I recommend reading ? to improve.

See the Nim learning resources here: 
[https://nim-lang.org/learn.html](https://nim-lang.org/learn.html)

Shameless plug for: 
[https://narimiran.github.io/nim-basics](https://narimiran.github.io/nim-basics)/
 which is described on our learning page as: "For programming beginners. Covers 
all the basic topics, enough to make your first programming steps."


Re: Nim Community Survey 2019

2020-02-19 Thread miran
The results of Nim Community Survey 2019 are now available at: 
[https://nim-lang.org/blog/2020/02/18/community-survey-results-2019.html](https://nim-lang.org/blog/2020/02/18/community-survey-results-2019.html)


Re: Nim Community Survey 2019

2020-02-10 Thread miran
**Last call**

Nim Community Survey 2019 will close in about 18 hours (Feb 11th, 6am UTC), now 
is your last chance to participate: 
[https://nim-lang.org/blog/2019/12/20/community-survey-2019.html](https://nim-lang.org/blog/2019/12/20/community-survey-2019.html)


Re: Parallel example for computing pi efficiently is actually slow

2020-02-09 Thread miran
Did you mis-read the top comment of the parallel version?

> # Compute PI in an **inefficient** way

.


Re: How to refer to a dynamically determined array

2020-02-05 Thread miran
> You will have to use a pointer to array, and you have to dynamically allocate 
> the block of memory where the array lives. We have in Nim a data type 
> UncheckedArray, maybe you can use ptr UncheckedArray.

Isn't the easier solution: "You should use `seq` for that"? :)


Re: Nim 1.0.6 is out!

2020-01-29 Thread miran
> Wasn't the weird 1.0.99 thing used for the in-development 1.1 version?

It was.

But Araq didn't like it, and it wouldn't play nice with the `.since` pragma and 
devel.


Re: Nim 1.0.6 is out!

2020-01-29 Thread miran
> the next version with minor change published should be normaly 1.1.0 or 1.1.2 
> now that the 1.1.1 version already exists.

What difference does it make to you personally if the next stable version is 
called 1.1 or 1.2?


Re: Nim 1.0.6 is out!

2020-01-27 Thread miran
> I don’t understand why the next version will be 1.2 whereas the version 1.1.1 
> hasn’t been published officially.

Do you understand why the current release is 1.0.6 (the previous was 1.0.4), 
"whereas the version 1.0.5 hasn’t been published officially"?


Re: Nim 1.0.6 is out!

2020-01-27 Thread miran
> I think it's headed for the 1.1 release.

Minor fix: Current devel is already v1.1.1, the next officially released 
feature release will be 1.2.0.


Re: Fizzbuzz game

2020-01-25 Thread miran
@zevv, you're not even trying! 43 whitespace characters saved:


for i in 1..100:
 echo case i mod 15
 of 0:"FizzBuzz"
 of 3,6,9,12:"Fizz"
 of 5,10:"Buzz"
 else: $i


Run


Re: Fizzbuzz game

2020-01-25 Thread miran
> one where you try to get the shortest amount of characters


for n in 1..100:echo [$n,"Fizz","Buzz","Fizz Buzz"][(n mod 3==0).int+2*(n 
mod 5==0).int]


Run

89 characters


Re: Why does this proc have side effects?

2020-01-16 Thread miran
> Why does this proc yield `Error: 'crossover' can have side effects`?

You are using `rand` which makes this proc non-deterministic, i.e. you will not 
always get the same result for the same input.


Re: Nim lang for beginners?????

2020-01-15 Thread miran
> Does anyone know of beginner Nim tutorials… (...) All of the tutorials I have 
> seen assume that you’re coming over from another language and thus don’t need 
> certain concepts explained.

>From 
>[https://narimiran.github.io/nim-basics](https://narimiran.github.io/nim-basics)
> :

> Who is this for?
> 
> * People with no or minimal previous programming experience

. 


Re: Nim Community Survey 2019

2020-01-14 Thread miran
> When's the cut-off?

>From the linked article:

> Submissions will be accepted until around February 2020, depending on the 
> response rates.

.


Re: Why is `1 +(2 + 3)` a syntax error?

2020-01-07 Thread miran
`1 +(2 + 3)` is translated to `1 +5`, and at that point, `+` is an unary 
operator (e.g. `+5` is a positive five, like `-5` is a negative five).

You can check this if you do `1 - +(2 + 3)`, which will give you `-4` as a 
result.


Re: Nim Community Survey 2019

2020-01-07 Thread miran
We already have more than 600 responses, but if you're not one of them: this is 
a reminder to give us your feedback. It should take about 5 minutes of your 
time.


Re: How to get left most 8 bit's value from a 32 bit integer ?

2020-01-02 Thread miran
I would do bitmasking + bitshifting:


let a = 0b1100_0101

let a_high = (a and 0b_0) shr 4
echo a_high # => 12 (0b1100)


Run


Nim Community Survey 2019

2019-12-26 Thread miran
If you haven't answered it already, here is Nim Community Survey 2019:

[https://nim-lang.org/blog/2019/12/20/community-survey-2019.html](https://nim-lang.org/blog/2019/12/20/community-survey-2019.html)

We would love to hear your opinions, and it will help us with our 2020 plans.


Re: Nim beginners tutorial

2019-12-16 Thread miran
> * Devote an introductory chapter to metaprogramming with a simple DSL 
> tutorial.
> 
> * And a chapter to major databases connection. (especially SQLite).
> 
> * I really wish you included a topic on concurrency and parallelism and how 
> you would normally use them in Nim.

All these topics go beyond _beginners_ tutorial.

I'll consider them for the "Intermediate Nim" tutorial if/when I begin to write 
it.


Re: Advent of Nim 2019 megathread

2019-11-30 Thread miran
12 hours to go!


Re: Archlinux updated to Nim 1.0.2

2019-11-27 Thread miran
> I was pleasantly surprised that Nim is not lagging behind anymore in the Arch 
> repo:

That would mean that I wouldn't be able to complain about Arch's lagging 
anymore, so we did the only reasonable thing — we released 1.0.4 :)


Advent of Nim 2019 megathread

2019-11-25 Thread miran
This Sunday, December 1st, will mark the start of the fifth edition of [Advent 
of Code](https://adventofcode.com/).

Advent of Code is, to quote its author, _“a series of small programming puzzles 
for a variety of skill sets and skill levels in any programming language you 
like”_.

The rules of AoC are quite simple. Starting from December 1st until Christmas, 
every day at 5 a.m. UTC a new task is released. The tasks consist of two parts, 
where second part is revealed after you solve the first part, and it is a 
continuation and/or variation of the first part. You don’t submit your code, 
just the result of your calculation.

The participation in AoC is free (although, if you like it, consider 
[donating](https://adventofcode.com/2018/support)), all you need to do is log 
in with your Github, Google, Twitter, or Reddit account.

If you have never participated in AoC before or you want to prepare yourself 
for the start of the competition by solving some tasks, take a look at [the 
previous events](https://adventofcode.com/2019/events).

# Nim leaderboard

We are organizing the official Nim [private 
leaderboard](https://adventofcode.com/2018/leaderboard/private), where you can 
compete against other Nim users. To join the Nim leaderboard, all you have to 
do is use `40415-c732e66e` code in the previous link.

If you are one of 120 (!) people who have joined this leaderboard last year, 
there's no need to do it again — you're already in.

# Misc

You can use this thread to post links to your AoC repositories, share your 
solutions, ask for help, discuss the tasks, etc. but have in mind these things:

1\. **SPOILERS** : Try to keep this thread as spoiler-free as possible: 
[r/adventofcode subreddit](https://old.reddit.com/r/adventofcode/) will have 
megathreads for each day and you can post there as soon as the global 
leaderboard is populated (and that is veeery quickly) — we would like to 
encourage you to share your Nim solutions there and showcase the beauty of Nim.

2\. **ASKING FOR HELP** : Feel free to ask for help either here or on Nim 
IRC/Gitter/Discord channel if you have some Nim-related problem, but have in 
mind that your snippets might contain spoilers for other who haven't solved the 
task yet — not everybody will be able to solve the tasks at 5 a.m. UTC. 
Consider waiting at least couple of hours before asking for help (in that time, 
try it some more to see if you can solve it by yourself :)).

3\. **HAVE FUN** : This is mandatory!

# Our AoC 2019 repositories

(this will be populated and continuously updated as people share links to their 
repos)


Re: Silly mistake in for loop but can't figure it out

2019-11-19 Thread miran
> It works for me

Because, as pointed out by @Stefan_Salewski, you didn't use **while** 
isMainModule.

@adnan if it wasn't obvious from the answers, you should use **when** 
isMainModule.


Re: A super newbie git-related question

2019-11-08 Thread miran
This is basically what I do too.

You need to do (only once): `git remote add upstream 
https://github.com/nim-lang/Nim.git`

And then, when I want to update my local `devel` branch (e.g. before creating a 
branch with some fix), I do: `git pull upstream devel`.

You still _push_ your changes to _your_ repo (`git push origin `), 
and then you can create a pull request.

* * *

Btw, it is not crucial that your branch must be ahead of `Nim/devel` (upstream) 
— this stuff matters only if you change some file that has also been changed 
there in the mean time.


Re: Get first element in Table

2019-11-07 Thread miran
> if you want to iterate and break after the first then you can use any of the 
> table types

It is just a current implementation detail / coincidence, that your first 
example returns `1` as the first key. Don't rely on that, please.

* * *

Btw, if you (plural) want sorted tables, there is a new player in the town: 
[https://github.com/narimiran/sorta](https://github.com/narimiran/sorta)

I've tested it as best as I could, but more eyes on it and some "in the wild" 
tests would be appreciated. (Also, some internal details need some polishing, 
but the public API should stay the same)


Re: I'd like to offer some suggestions re: Nim documentation. Github? This forum?

2019-11-05 Thread miran
> I'd like to offer various suggestions or fixes (where I can).

Ideally, you can immediately send pull requests with the documentation 
improvements, no need to discuss it or open issues.

> (...) inconsistent organization. (...) Is creating issues on Github the 
> preferred mechanism for initiating such discussions?

This might be already discussed at some point, search [these 
issues](https://github.com/nim-lang/Nim/issues?q=is%3Aopen+is%3Aissue+label%3ADocumentation)
 to see if what you had in mind has already been brought up.

If it wasn't, feel free to either open a new issue or discuss it here in this 
thread.


Re: Why is Seq.reverse() not part of the standard lib?

2019-11-05 Thread miran
> I think we need either iterator chaining like (...) zero-functional

For those who are not familiar with it, take a look at: 
[https://github.com/zero-functional/zero-functional](https://github.com/zero-functional/zero-functional)


Re: read number from ascii (text) file: scanf-like functionality?

2019-10-31 Thread miran
  1. go to 
[https://nim-lang.org/documentation.html](https://nim-lang.org/documentation.html)
  2. click on 'standard library', first link on the left
  3. either you:



3a. do ctrl+F 'scanf', so you will see: "strscans This module contains a scanf 
macro for convenient parsing of mini languages."

3b. use the search box on the left, and it will give you the direct link to 
[https://nim-lang.org/docs/strscans.html](https://nim-lang.org/docs/strscans.html)


Re: Manu v1.1 - Matrix Numeric package released!

2019-10-29 Thread miran
> If only some weren't obsessed with performance they would see the issue. 
> [...] others choose to show off in every thread and every chat. Enough said.

This is unnecessary harsh. Everybody makes some silly mistakes from time to 
time.

@mratsim is one of the most helpful members of our community. I hope he will 
continue to "show off in every thread and every chat" and share his knowledge 
and experience.


Re: Importing types for different module

2019-10-28 Thread miran
You need an export marker (`*`) for the stuff you want to be visible in other 
modules, e.g.: `var stack*: seq[Context]`


Re: 1.0.0 is here

2019-10-23 Thread miran
Exactly one month after the release of 1.0.0, it is time for our first patch 
release: **Nim 1.0.2**

This version contains more than 50 fixes since v1.0.0. The list of changes can 
be seen [here](https://github.com/nim-lang/Nim/compare/v1.0.0...v1.0.2).


Re: nimpretty binary could not be found

2019-10-23 Thread miran
> next week, from what month ? ;-)

Heh, that was the original plan, but things went their own way.

You don't need to wait no more: Nim v1.0.2 is, as of today, officially out.


Re: Import best practices

2019-10-20 Thread miran
https://narimiran.github.io/2019/07/01/nim-import.html


Re: Getter and Setter methods in Nim

2019-10-16 Thread miran

proc getAge(a: Human): int =
  return a.age

echo Frank.getAge() # or: getAge(Frank)


Run

.


Re: split does not seem to work properly

2019-10-15 Thread miran
> As you can guess, my idea is to parse a comma separated value file, or csv 
> file for short. (...) I don't have any experience with Python at all.

I have a lot of experience with Python and this is sincere advise without being 
snarky: don't try to write your own manual csv parser, use `csv` module: 
[https://docs.python.org/3/library/csv.html](https://docs.python.org/3/library/csv.html)
 (I've learnt that the hard way. Never again.)

> Probably, if I knew Python, I would be able to devise a good solution for Nim.

Translating Python solution I advise above to Nim, you should use `parsecsv` 
module: 
[https://nim-lang.github.io/Nim/parsecsv.html](https://nim-lang.github.io/Nim/parsecsv.html)


Re: Hacktoberfest with Nim

2019-10-15 Thread miran
BUMP!

Half of October is behind us, two more weeks to make your PRs to win a T-shirt.


Re: split does not seem to work properly

2019-10-15 Thread miran
Change `s = readFile(paramStr(1)).split(Whitespace)` to `s = 
readFile(paramStr(1)).strip.split(Whitespace)`


Re: Nim beginners tutorial

2019-10-14 Thread miran
There is now an experimental .epub version of the tutorial, available at 
[https://github.com/narimiran/nim-basics/raw/master/nim-basics.epub](https://github.com/narimiran/nim-basics/raw/master/nim-basics.epub)

It looks ok when I view it in Calibre, but I don't know how it is on a physical 
ebook reader since I don't have one. If you own an ebook reader, I would like 
to hear your feedback before I make it public/official.

What I'm interested in: are font sizes ok (I guess you can change that to your 
suiting, but I'd like to have sane defaults), are left and right margins ok, 
are code samples shown properly (without some unintended line breaks where 
there should be none), and... anything else that you notice.


Re: Throw-away variables?

2019-10-13 Thread miran
Related: if you want to unpack other datatype, there is `unpack` package: 
[https://github.com/technicallyagd/unpack](https://github.com/technicallyagd/unpack)


Re: TaintedString Error with Sequence

2019-10-10 Thread miran
`newSeqWith` is usually used for creating 2D sequences, where you pass to it a 
function for creating inner sequences.

Here it seems to me that you wanted to initialize a sequence of string of 
initial length of 1400. If so, use `newSeq[string](1400)`. (Later on, 
`texts.add(s)` should be replaced)


Re: beginners tutorial

2019-10-10 Thread miran
> This is a clone of @miran post

LOL, and I thought about responding "you're not the only/first one to think 
that" :D I didn't recognize my own words.


Re: default values for objects

2019-10-09 Thread miran
> Usual way to do this is with a newFoo proc.

I think this might be more versatile:


type
  Foo = object
bar: int
value: float


proc initFoo(bar = 42, val = 3.2): Foo =
  Foo(bar: bar, value: val)

var foo1 = initFoo()
var foo2 = initFoo(val = 9.9)
var foo3 = initFoo(21, 17.34)

echo foo1 # => (bar: 42, value: 3.2)
echo foo2 # => (bar: 42, value: 9.9)
echo foo3 # => (bar: 21, value: 17.34)


Run


Re: error Nim Compiler Version 1.0.0 [Windows: amd64]

2019-10-09 Thread miran
What you probably want is: `var a = uint32(0x8000_)`


Re: Nim Coding Examples and Exercises for beginners?

2019-10-08 Thread miran
For Tic Tac Toe (and maybe some other interesting small projects): take a look 
at "Nim Days" 
[https://xmonader.github.io/nimdays](https://xmonader.github.io/nimdays)/


Re: Nimble build error

2019-10-07 Thread miran
Did you mean to do `nimble install easygl`?


Re: NIM in action offline resources

2019-10-07 Thread miran
@pouya Now I use completely different tool for creating .epub version, and I 
have basically zero options to decide about some style details, but on the 
other hand, it should have better support for e-readers out of the box. (e.g. 
table of contents is now there)

The link is the same as before: 
[https://github.com/narimiran/nim-basics/raw/master/nim-basics.epub](https://github.com/narimiran/nim-basics/raw/master/nim-basics.epub)

I would like to hear your feedback, but I think it is better if we continue 
this discussion in the thread about Nim Basics: 
[https://forum.nim-lang.org/t/3917](https://forum.nim-lang.org/t/3917)


Re: nimpretty binary could not be found

2019-10-03 Thread miran
It is a known problem, and we will fix it (ship nimpretty with Windows version) 
for v1.0.2 coming out next week.


Re: NIM in action offline resources

2019-10-03 Thread miran
> there is no way to upload images in the forum

If you could upload them to [imgur](https://imgur.com/) or any other 
image-sharing site, and then post links here, it would be really helpful for me 
to see what is going on. (I'm not seeing that in Calibre)

> Table Of Contents doesn't work as expected.

Can you please expand on this? You cannot click on an item that leads you to 
some chapter/section? Something else?

> i wish you have never stopped typing the material is pretty useful and 
> crystal clear. Many thanks, hope you continue to write more about NIM.

Thank you for your kind words :) Who knows, maybe in 2020 I manage to write a 
sequel ;)


Re: Nim in Action Help thread

2019-10-03 Thread miran
> `nim -v Nim Compiler Version 0.20.99`

Is there a reason why you didn't update to v1?


Re: NIM in action offline resources

2019-10-03 Thread miran
> Mirans tutorial is available as PDF and HTML, it is based on Asciidoctor, 
> maybe you can generate epub yourself.

If there is a need for .epub format, I can see if I can make one officially 
available.


Hacktoberfest with Nim

2019-10-02 Thread miran
[Hacktoberfest](https://hacktoberfest.digitalocean.com/) is, by their own 
words: "a month-long celebration of open source software". It happens every 
year in October, and it is open for everybody to participate.

Long story short: after you register at [their 
site](https://hacktoberfest.digitalocean.com/) (you can login via Github), you 
need to **make 4 pull requests** (they don't have to be merged) in October to 
any open source repository on Github and you will receive a Hacktoberfest 
T-shirt.

Nim would like to encourage you to participate in Hacktoberfest by contributing 
to [our repo](https://github.com/nim-lang/nim). You can help in various ways:

  * bug fixing
  * writing/improving a library



* * *

1\. Bug fixing

We have around 1300 open issues, which might be overwhelming to start, so here 
are some suggestions:

  * issues marked with [Hacktoberfest 
tag](https://github.com/nim-lang/Nim/issues?q=is%3Aopen+is%3Aissue+label%3AHacktoberfest)
 should be easy to start
  * if you don't feel like writing code, take a look at [Documentation 
tag](https://github.com/nim-lang/nim/issues?q=is%3Aopen+is%3Aissue+label%3ADocumentation)
  * if you want something more challenging, see [Stdlib 
tag](https://github.com/nim-lang/nim/issues?q=is%3Aopen+is%3Aissue+label%3AStdlib)
 or [High Priority 
tag](https://github.com/nim-lang/nim/issues?q=is%3Aopen+is%3Aissue+label%3A"High+Priority;)



* * *

2\. Writing/improving a library

There is a [list of needed 
libraries](https://github.com/nim-lang/needed-libraries/issues): can you help 
us shorten it?

Once you have written a library, you should send a PR to [nimble package 
repo](https://github.com/nim-lang/nimble) to include your package in the 
official list of packages!

If writing a library seems like a too demanding task, you can help improve [one 
of the existing Nim packages](https://nimble.directory/) by adding a feature, 
fixing a bug, or writing more informative documentation.

* * *

Happy hacking,

The Nim Team


Re: Nim for Beginners Video Series

2019-10-02 Thread miran
Suggestion:

Don't have an empty VSCode at the beginning of each video: show a text file 
with "table of contents" of what you will be talking about in the video


Re: Proposal to start a Nim-Scientific Community

2019-10-01 Thread miran
> What do you think is the most lacking in Nim at the moment for Scientific 
> related stuff?

The first thing (it doesn't mean it is the most important) that came to my 
mind: one plotting library to rule them all. Something all-around like 
matplotlib, but with sane API :)

For other stuff: I agree with @mratsim's list above.


Re: Front page example

2019-10-01 Thread miran
There is now a different iterator example on the website. Hopefully it won't 
confuse people anymore.


Re: Front page example

2019-10-01 Thread miran
Every number in `[10, 20, 30, 40, 50, 60]` is even. That's on purpose.

This iterator returns elements at odd _positions_ , i.e. index 1, 3, 5.


Re: Nim source size

2019-09-27 Thread miran
> For anyone who want to get in with Nim quickly - use Manjaro

Btw, Nim v1.0 has already hit Manjaro Testing branch (only half a day after the 
release!), and it will be part of the next Stable update.

(Bleeding edge Arch still has Nim v0.18, lol)


Re: Nim beginners tutorial

2019-09-27 Thread miran
To celebrate the release of Nim v1.0, the tutorial has been updated.

Several typos and errors have been fixed, but the most noticeable improvement 
is in the [PDF 
version](https://github.com/narimiran/nim-basics/raw/master/nim-basics.pdf) of 
the tutorial, which is now much nicer to read, and not just an afterthought 
like previously.

If you prefer the web version, it is still at 
[https://narimiran.github.io/nim-basics](https://narimiran.github.io/nim-basics)/


Re: Set Literal Problems

2019-09-27 Thread miran
How about something like this:


type
  MyRange = range[0'u8 .. 15'u8]

var s = {12.MyRange}


Run


Re: 1.0.0 is here

2019-09-25 Thread miran
> Here is Julia's: 
> [https://discourse.julialang.org/t/version-1-0-released-of-nim-programming-language/29099/16](https://discourse.julialang.org/t/version-1-0-released-of-nim-programming-language/29099/16)

And here we go once again, people who didn't even bother to see how 
style-insensitivity works in Nim:

> Case-insensitivity sounds like a terrible feature, and would break much of my 
> code. `N` and `n`, `A` and `a`, `i` and `I`.

I don't have an account there, so if somebody wishes to reply there, tell @DNF 
that all these are distinct, as the first character is case sensitive.


Re: Compiling?

2019-09-24 Thread miran
> Is there a way to get the .c file before the compilation to binary?

`~/.cache/nim`


Re: WinCon vs 1.0.0

2019-09-24 Thread miran
> So, what should we do now ?

You should definitely tell us about it for the fourth time in a single day.


Re: Great tutorials needed

2019-09-24 Thread miran
> is the "miran" in "narimiran" the same as @miran ? if so, nice work, thanks !

It is, thanks :)


Re: Great tutorials needed

2019-09-24 Thread miran
We have these: 
[https://nim-lang.org/learn.html](https://nim-lang.org/learn.html)

Whether those are "nice and clear step by step tutorials with great 
explanation" it is up to the reader to decide.


Re: How to use extract string with contains a certain pattern?

2019-09-03 Thread miran
> xmltree could handle it, so ... bug report please.

It is a known issue: 
[https://github.com/nim-lang/Nim/issues/1034](https://github.com/nim-lang/Nim/issues/1034)
 and 
[https://github.com/nim-lang/Nim/issues/11713](https://github.com/nim-lang/Nim/issues/11713)


Re: Exe file is closes very quickly

2019-08-31 Thread miran
> procedure to wait for the user answer to close the window

You can use `readLine` at the end of your program. See some examples in 
[tut1](https://nim-lang.github.io/Nim/tut1.html#the-first-program) and [Nim 
Basics](https://narimiran.github.io/nim-basics/#_reading_user_input).


Re: Came across a video talking about NIM

2019-08-31 Thread miran
> the book expects you to have some other language knowledge first

[Nim basics tutorial](https://narimiran.github.io/nim-basics/) doesn't expect 
you to have some prior knowledge, and shows you the basic concepts in Nim.


  1   2   3   >