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
<dom96> huh, doesn't show some repos
<FromDiscord_> <Avatarfighter> the link i sent filters by the most stars, so you can probably find more unknown ones by doing least stars or something, I just do most stars so i get a sense of what people like
<dom96> yeah, but it doesn't list some repos that have a lot of stars
<dom96> for example https://github.com/dom96/jester
<FromDiscord_> <Avatarfighter> welp
<FromDiscord_> <Avatarfighter> idk what to tell you other than i'm going to learn your lib after i'm done with karax haha
From IRC (bridge bot)
@FromIRC
<FromDiscord_> <Avatarfighter> argh i want to make something this cool haha
Andreas Hauser
@ahcm
Is there an idiom for this python: info = dict(part.split("=") for part in comment.split(" "))
Kaushal Modi
@kaushalmodi
what does that do? convert "abc=def ghi=jkl" to {"abc":"def", "ghi":"jkl"}?
Andreas Hauser
@ahcm
yepp
not a big thing, just like to get to know nim
From IRC (bridge bot)
@FromIRC
<FromDiscord_> <Avatarfighter> im not exactly a nim expert, but from my current level of understanding of the language I personally might do: https://dsh.re/a7738
<FromDiscord_> <Avatarfighter> i just realized that since my variable str doesn't get mutated you can probably just do let str = "abc=def ghi=jkl"
<FromDiscord_> <Avatarfighter> @ahcm hope that helps !
awr1
@awr1
@ahcm
import std / [strtabs, strutils]
echo("abc=def ghi=jkl".split({'=', ' '}).newStringTable(modeCaseSensitive))
From IRC (bridge bot)
@FromIRC
<FromDiscord_> <Avatarfighter> lmao that also works
<disruptek> !echo "sup dawg"
awr1
@awr1
think it's !eval
From IRC (bridge bot)
@FromIRC
<disruptek> oh.
Kaushal Modi
@kaushalmodi
@ahcm using comprehension
From IRC (bridge bot)
@FromIRC
<disruptek> !eval echo "awwwww sup"
awr1
@awr1
!eval echo("what's up")
Kaushal Modi
@kaushalmodi
import std/[strutils, strformat, tables], comprehension
let
  mySeq = "abc=def ghi=jkl".split(' ')
echo comp{for _, v in mySeq: {v.split('=')[0] : v.split('=')[1]}}
From IRC (bridge bot)
@FromIRC
<NimBot> awwwww sup
<NimBot> what's up
<disruptek> !help
Kaushal Modi
@kaushalmodi
@ahcm nimble install https://github.com/alehander42/comprehension@#head
From IRC (bridge bot)
@FromIRC
<disruptek> it's eval but the bot knows no other commands. :⁠/
<FromDiscord_> <Avatarfighter> welp i feel bad now because of my answer its so long compared to you guys lol!
<disruptek> it's not about the length.
Kaushal Modi
@kaushalmodi
@awr1 The newStringTable is new to me.. need to look into it
From IRC (bridge bot)
@FromIRC
<disruptek> it's about the GIRTH.
Kaushal Modi
@kaushalmodi
Avatarfight: don't worry about lenght
s/lenght/length
this is what I have in my notes:
import std/[strutils, strformat, tables]
import comprehension

let
  myStr = "abc=def ghi=jkl"
  mySeq = myStr.split(' ')
  myTable = comp{for key, val in mySeq: {val.split('=')[0] : val.split('=')[1]}}

echo &"myStr of type {$type(myStr)} = {myStr}"
echo &"mySeq of type {$type(mySeq)} = {mySeq}"
echo &"myTable of type {$type(myTable)} = {myTable}"
awr1
@awr1
it's more or less just the same thing as std / table just more efficent string to string mappings
Andreas Hauser
@ahcm
@awr1 @kaushalmodi thanks, the .newStringTable is interesting
awr1
@awr1
nim needs a bijective map library / stdlib module
awr1
@awr1
out of curiosity how do y'all usually declare multiple variables? https://play.nim-lang.org/#ix=1Pt6
Kaushal Modi
@kaushalmodi
I do A
awr1
@awr1
i personally do type A because it seems more syntactically "in line" with the rest of the langauge (such as how it's encouraged to put all your types in the same type block)
Kaushal Modi
@kaushalmodi
.. even if it's one var
Andreas Hauser
@ahcm
type A is so nice
awr1
@awr1
imagine, in bizarro nim world https://play.nim-lang.org/#ix=1Pt8
Kaushal Modi
@kaushalmodi
added that comprehension example to my notes: https://scripter.co/notes/nim/#code-snippet--comp-from-str-to-table
From IRC (bridge bot)
@FromIRC
<PMunch> Yay, people are using the playground ix links :⁠)