Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 04 12:26
    @dom96 banned @acroobat
  • Mar 03 2017 15:52
    @dom96 banned @Octopoda7
  • Feb 12 2017 23:57
    @dom96 banned @zzz125
  • Dec 23 2016 19:43
    @dom96 banned @Izrab
From IRC (bridge bot)
@FromIRC
<FromDiscord> <haxscramper> !eval import fusion/btreetables
<NimBot> <no output>
<FromDiscord> <Recruit_main707> !eval import opengl
<NimBot> Compile failed: /usercode/in.nim(1, 8) Error: cannot open file: opengl
<FromDiscord> <haxscramper> Yeah, AFAIK for 1.4+ it is shipped with regular nim installation, no additional work needed. So it is kind of std++
<FromDiscord> <Recruit_main707> but i think there is no issue with having a simple stdlib, specially since nim has an official package manager and makes it very easy to add 3rd party libraries to your code
<ForumUpdaterBot> New thread by Fxn: Are these constants effectively saving computations?, see https://forum.nim-lang.org/t/7138
From IRC (bridge bot)
@FromIRC
<PMunch> New stream tonight! Adding some features to notifishower, and showing how it can be used to create custom notifications for things. Aiming to start at 17UTC.
<FromDiscord> <Quibono> @nikki I just benchmarked it and using two & is about twice as fast as fmt()
Alexander Ivanov
@alehander92
Araq I can just revert and rebase to a working state
my pr
Helmut Jarausch
@HJarausch_gitlab
I'd like to write a proc 'Sum' which has a can be passed a Slice or 'countup(...)'. What type should this parameter have. I cannot pass 'countup(..)' to parameter of type Slice. Thanks for a hint, Helmut
From IRC (bridge bot)
@FromIRC
<PMunch> Well, unfortunately for you countup is an iterator
<PMunch> And iterators (not closure iterators) work by rewriting the AST, so they don't really have a type as such
<PMunch> There is a way around this however, and that is by creating an Iterateable concept and wrapping it in a closure iterator
<PMunch> Or by making your sum proc a macro instead
From IRC (bridge bot)
@FromIRC
<FromDiscord> <haxscramper> Or make a proc that returns closure iterator. https://play.nim-lang.org/#ix=2F5i
<FromDiscord> <haxscramper> Kind of strange there is no items overload for closure iterators though
Helmut Jarausch
@HJarausch_gitlab
@PMunch How to "Iterateable concept and wrapping it in a closure iterator". @FromDiscord thanks for the example, still, I don't see how to pass [in Python syntax] either 'range(0,7)' or 'range(0,7,2)' - and 'Sum' was only a simple example
From IRC (bridge bot)
@FromIRC
<PMunch> Weeeell, it's a bit tricky..
<PMunch> For now just create a template wrap that wraps an iterator into a closure iterator and use that instead
咚咔
@cupen
In nim way, how to write for (int i = 0; i < 100; i++)??
From IRC (bridge bot)
@FromIRC
<PMunch> for i in 0..<100
咚咔
@cupen
Thanks
From IRC (bridge bot)
@FromIRC
<FromDiscord> <haxscramper> @HJarausch_gitlab if you only need something like python range you can do it just ifne with regular iterators - https://play.nim-lang.org/#ix=2F5t
<FromDiscord> <haxscramper> Although range is an identifier name for a type from system, so you might want to use different name. That is, for python-like 'range'
<PMunch> @haxscramper, I think he wants to take the equivalent of Pythons range as an argument
<FromDiscord> <haxscramper> Then https://play.nim-lang.org/#ix=2F5y
From IRC (bridge bot)
@FromIRC
<FromDiscord> <haxscramper> Python's range is a class actually (I thought it is some kind of magic built-in) with index index defined, so example above should be pretty similar both from use-case standpoint and implementation (object (or object-like thing in case of iterator(): int) with some special magic going on inside).
Helmut Jarausch
@HJarausch_gitlab
@FromDiscord Yes thanks, that's exactly what I was looking for. Still, why do I need that 'iterator itemsT: T): T', isn't that built into Nim already?
From IRC (bridge bot)
@FromIRC
<FromDiscord> <haxscramper> apparently no, although I was also surprised that it isn't
<FromDiscord> <haxscramper> E.g. it is probably very logical thing to do
<FromDiscord> <haxscramper> when you have closure iterator and want to use it in for loop
<FromDiscord> <haxscramper> Maybe I should just PR it into stdlib now
Helmut Jarausch
@HJarausch_gitlab
I'd like to suggest to extend the 'collect' macro to include (standard Nim's bit) set. If that would be available I wouldn't need that "passing an iterator around" stuff in my current case. Still, it is very interesting.
From IRC (bridge bot)
@FromIRC
<FromDiscord> <lqdev> that's a good idea
<FromDiscord> <lqdev> i'm quite surprised it doesn't support them
<FromDiscord> <lqdev> probably an oversight
<FromDiscord> <lqdev> @HJarausch_gitlab can you open an issue on github?
<FromDiscord> <haxscramper> https://play.nim-lang.org/#ix=2F5K
<FromDiscord> <haxscramper> It does support set[T]
<FromDiscord> <haxscramper> But again, you need to use some non-obvious proc initSet[A](): set[A] = discard thing
<FromDiscord> <haxscramper> Which does not come with stdlib
From IRC (bridge bot)
@FromIRC
<FromDiscord> <haxscramper> I can add initSet too - will be PR'ing items for iterator(): T anyway so
<FromDiscord> <haxscramper> Although I don't know where I should put it exactly. newSeq is in std/system, probably makes sense to add initSet too.
Helmut Jarausch
@HJarausch_gitlab
@FromDiscord I've tried to adapt your example (https://play.nim-lang.org/#ix=2F5R) but is crashes Nim 1.5.1 git hash: d9038ed792b923cfbb9593ab82825fdb48728adc)
From IRC (bridge bot)
@FromIRC
<FromDiscord> <lqdev> @haxscramper imo something like collect(set[uint16] {}) should be supported too
Helmut Jarausch
@HJarausch_gitlab
I've fixed my example https://play.nim-lang.org/#ix=2F5T but it still crashes
From IRC (bridge bot)
@FromIRC
<FromDiscord> <lqdev> btw @HJarausch_gitlab, FromDiscord is the bot that bridges discord to IRC and Gitter. if you want to ping any of us, use the name in <> in the bot's message
<FromDiscord> <haxscramper> nnkCall, nnkIdent, nnkSym - @HJarausch_gitlab you can only use identifier or call in collect argument