by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 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
<dom96> !eval import times; echo((epochTime() + 5, "foobar") < (epochTime() + 10, "alberta"))
<NimBot> true
<dom96> @Araq: Why is there a < for tuples?
<TheLemonMan> consistency™ probably, but it makes no sense
<dom96> Python does it too
<dom96> !eval echo((5.5, 30) < (10.0, 25))
Kaushal Modi
@kaushalmodi
dom96: For version compares
From IRC (bridge bot)
@FromIRC
<NimBot> true
<dom96> A tuple containing a float and a string?
<dom96> Okay, sure, if the tuple is all numbers then I can deal with that
<dom96> But it just compares the first position and calls it a day
<dom96> !eval echo((5.5, 30) < (10.0, 25, 56, 123123))
<NimBot> Compile failed: in.nim(1, 16) Error: type mismatch: got <tuple of (float64, int), tuple of (float64, int, int, int)>
<dom96> !eval echo((5.5, 30, 102131023213, 124124) < (10.0, 25, 56, 123123))
<NimBot> Compile failed: in.nim(1, 38) Error: type mismatch: got <tuple of (float64, int, int64, int), tuple of (float64, int, int, int)>
From IRC (bridge bot)
@FromIRC
<dom96> !eval echo((5.5, 30, 102131023213, 124124) < (10.0, 25, 56'i64, 123123))
<NimBot> true
Kaushal Modi
@kaushalmodi
dom96: It keeps on going till the first non-equal match from the left
agreed that the < should be made to works on tuples where it made sense
More than those tuple compares, I find the string compares strange: https://scripter.co/notes/nim/#string-comparison
Oscar Nihlgård
@GULPF
the tuple thing can be used to sort on multiple fields, e.g lst.sortedByIt((it.field1, it.field2))
Bung
@bung87
@Araq thanks! I posted a issue to regex just now.
Kaushal Modi
@kaushalmodi
Talking about regex, where can I find good examples of replace from nre module?
From IRC (bridge bot)
@FromIRC
<dom96> The nre module is deprecated
Kaushal Modi
@kaushalmodi
So what's the best way for search/replace using regex?
Dmitry Atamanov
@data-man
I think the best way to replace PCRE with PCRE2. PCRE2 has very cool https://www.pcre.org/current/doc/html/pcre2_substitute.html
Kaushal Modi
@kaushalmodi
I believe we don't have a Nim wrapper for that, right?
I was just playing with regex and replacements and was trying to figure out the current best way to do it
As a side note, where are the older changelogs saved on the devel branch?
I was trying to find the version where nre got deprecated
From IRC (bridge bot)
@FromIRC
<shashlick> @kaushalmodi: look at nimgen source code - using regex extensively there
Kaushal Modi
@kaushalmodi
regex is the nimble package, right?
From IRC (bridge bot)
@FromIRC
<shashlick> I used nre a lot in the past but have started using nim-regex now cause it is pure nim
<shashlick> I believe @data-man is looking into a PCRE2 wrapper
Kaushal Modi
@kaushalmodi
shashlick: Thanks!
Until nim-regex gets into core, the re module is the best way?
From IRC (bridge bot)
@FromIRC
<dom96> @kaushalmodi: the 're' module
<shashlick> if you are bothered by the pcre.dll requirement, check out nimpcre
Bung
@bung87
could use https://github.com/genotrance/nimgen wrap pcre or https://github.com/google/re2 I think,but I dont have that skill.
From IRC (bridge bot)
@FromIRC
<shashlick> pcre is already wrapped by re and you can use nimpcre to build it into your binary
<shashlick> pcre2 - data-man is looking into it
Kaushal Modi
@kaushalmodi
I just tried out https://ptpb.pw/S6Of/nim .. works fine
.. was basically writing a reply to https://mstdn.io/@xahlee/100600228333192182
From IRC (bridge bot)
@FromIRC
<shashlick> google/re2 - looks like C++ so might be harder to wrap, but will check it out
Kaushal Modi
@kaushalmodi
btw I use the (?i) syntax from nre in that example using re
and it worked
but that is not documented anywhere on https://nim-lang.org/docs/re.html
From IRC (bridge bot)
@FromIRC
<shashlick> that's just pcre syntax right?
Kaushal Modi
@kaushalmodi
hmm.. TIL