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
<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 :⁠)
From IRC (bridge bot)
@FromIRC
<FromDiscord_> <Avatarfighter> Playground is so cool that’s another thing noted!
From IRC (bridge bot)
@FromIRC
Luke Parker
@kayabaNerve
Took me a few minutes to find out that was not the cryptocurrency :thinking:
From IRC (bridge bot)
@FromIRC
<PMunch> Avatarfighter, thanks
From IRC (bridge bot)
@FromIRC
<shomodj> shashlick thanks!
From IRC (bridge bot)
@FromIRC
<disruptek> i could see something like this: https://play.nim-lang.org/#ix=1PtT
<PMunch> disruptek, that would actually be pretty cool
<PMunch> Easily done with a macro though
<sschwarzer> PMunch ;⁠-)
<PMunch> Haha
<disruptek> is it? i thought it would puke on the syntax.
From IRC (bridge bot)
@FromIRC
<PMunch> Well maybe not that exact syntax
<disruptek> using gets you pretty close to that, so it would really have to buy you something.
<disruptek> can you export foo as bar?
From IRC (bridge bot)
@FromIRC
<PMunch> Think so yeah
From IRC (bridge bot)
@FromIRC
<dom96> yglukhov[m], should toJSStr function fail when a string with binary data is passed in? (nim-lang/Nim#2945)
From IRC (bridge bot)
@FromIRC
<FromDiscord_> <turbosoggy> Why use nim inatead of Go
From IRC (bridge bot)
@FromIRC
<shashlick> Depends what you want to do but Nim is much more powerful for me
<shashlick> I used Go briefly before I discovered Nim and felt restricted
<FromDiscord_> <turbosoggy> What do u like about nim