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
<NimBot> Compile failed: /usercode/in.nim(1, 12) Error: undeclared identifier: 'math'
<dadada> PMunch: this syntax is clearly indicating what's expected to happen, which isn't the same (IMO) as what packages* does, although it's very similar of course, vertical vs horizontal
<clyybber> !eval import math; echo 0.5 / math.sqrt(5)
<NimBot> Compile failed: /usercode/in.nim(1, 34) Error: ambiguous call; both math.sqrt(x: float32) [declared in /playground/nim/lib/pure/math.nim(261, 8)] and math.sqrt(x: float64) [declared in /playground/nim/lib/pure/math.nim(262, 8)] match for: (int literal(5))
<narimiran> !eval import math; echo 10.0 / sqrt(25.0)
<clyybber> !eval import math; echo 0.5 / math.sqrt(5'f)
<NimBot> 2.0
<NimBot> 0.223606794466938
<clyybber> axion: I think your error is about the whole expression
<axion> hmm the error is in the / actually. must be an overload somewhere
<dadada> PMunch: btw, I'm not just testing this on play.nim-lang, I needed the same in some of my code just now
<axion> I'm not sure what's going on. I have a / proc, but it accepts float32. Not sure how to figure out where this error is coming from: https://i.lisp.cl/fLrYbm.png
<narimiran> go to definition of that /
<axion> it jumps to https://i.lisp.cl/fLrYbm.png
<clyybber> axion: See, the problem is the whole expression
<axion> oops
<narimiran> are you sure trace is a float?
<axion> proc /*(x, y: float): float {.magic: "DivF64", noSideEffect.}
From IRC (bridge bot)
@FromIRC
<narimiran> (it shouldn't matter, silly me)
<clyybber> your s is an int
<axion> yes. it is defined to be the addition of 3 float32's
<axion> ohh
<clyybber> heh
<narimiran> i think clyybber got it right :⁠)
Kaushal Modi
@kaushalmodi
narimiran: If trace is not a float, he would have got
but expected one of: 
proc sqrt(x: float32): float32
  first type mismatch at position: 1
  required type for x: float32
  but expression 'num' is of type: int
proc sqrt(x: float64): float64
  first type mismatch at position: 1
  required type for x: float64
  but expression 'num' is of type: int
From IRC (bridge bot)
@FromIRC
<axion> thanks. that was it. sigh
Kaushal Modi
@kaushalmodi
heh s was int?
From IRC (bridge bot)
@FromIRC
<narimiran> axion: now when we know where the problem is, you can remove that math. if you want
<axion> Yeah, s was an int. I was being dumb 100 lines back it seems.
Kaushal Modi
@kaushalmodi
axion: If you don't want to import the whole math, you can even do from math import sqrt
From IRC (bridge bot)
@FromIRC
<axion> Yup, I know. Thanks all for the help
Kaushal Modi
@kaushalmodi
but yeah, doing PKG.PROC is very unnimly
From IRC (bridge bot)
@FromIRC
<narimiran> @kaushalmodi, it doesn't "import the whole math" even if you do import math
<axion> I had to do that exactly once in these 5000 lines of code so far in my first project. It does indeed seem to be rare you'd need to do that
Kaushal Modi
@kaushalmodi
narimiran: TIL
From IRC (bridge bot)
@FromIRC
<dadada> PMunch: nevermind your original foo* way would also do the job, as long as it works :⁠-)
<FromDiscord> <Rika> yall just import lenientops ez fix
<axion> it's my understanding that instead of math.sqrt you can turn the custom proc into a generics so it isn't less specialized, or over-specialize the custom proc. it's rare i have to explicitly qualify the module to remove an ambiguity
<axion> err is less specialized*
From IRC (bridge bot)
@FromIRC
<axion> I decided yesterday that I'm sticking with Nim as my primary everyday language. I wrote a lot of code to understand it fairly well so far, so I think Lisp is in my past :⁠)
<clyybber> Whoo
<clyybber> we achieved the impossible
<axion> Ha
<clyybber> "Lisper switched to it" <- put that on the website
Kaushal Modi
@kaushalmodi
axion: yay!
(yay)
From IRC (bridge bot)
@FromIRC
<leorize> axion: does that mean we're gonna see a new blogpost from you? :⁠)
<FromDiscord> <Rika> lisper switches to nim unprecedented news
<axion> leorize: haha i think so, yes. But probably not before I learn jester or whatever the greatest web framework is these days. My blog hasn't been updated in forever due to a maintenance disaster due to like 30 lisp dependencies
Kaushal Modi
@kaushalmodi
axion: Switch to hugo, it's awesome