code logs -> 2020 -> Fri, 03 Jan 2020< code.20200102.log - code.20200104.log >
--- Log opened Fri Jan 03 00:00:03 2020
00:09 JustBob [justbob@Nightstar.Customer.Dissatisfaction.Administrator] has quit [[NS] Quit: This unit is entering a hibernation state.]
00:16 McMartin [mcm_laptop@Nightstar-cf4v5v.sndgca.sbcglobal.net] has joined #code
00:36 McMartin [mcm_laptop@Nightstar-cf4v5v.sndgca.sbcglobal.net] has quit [Operation timed out]
00:58 gnolam_ [quassel@Nightstar-o3qe20.priv.bahnhof.se] has quit [[NS] Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
01:16 macdjord|slep [macdjord@Nightstar-bt331u.dsl.bell.ca] has quit [Ping timeout: 121 seconds]
01:18 celmin|away is now known as celticminstrel
01:20 macdjord [macdjord@Nightstar-bt331u.dsl.bell.ca] has joined #code
01:20 mode/#code [+o macdjord] by ChanServ
01:20 McMartin [mcm_laptop@Nightstar-cf4v5v.sndgca.sbcglobal.net] has joined #code
01:21 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
02:04 Alek [Alek@Nightstar-o723m2.cicril.sbcglobal.net] has quit [[NS] Quit: brb]
02:11 Alek [Alek@Nightstar-o723m2.cicril.sbcglobal.net] has joined #code
02:11 mode/#code [+o Alek] by ChanServ
02:16 McMartin[zomg] [mcmartin@Nightstar-c25omi.ca.comcast.net] has joined #code
02:16 McMartin is now known as NSGuest30127
02:16 McMartin[zomg] is now known as McMartin
02:17 NSGuest30127 [mcm_laptop@Nightstar-cf4v5v.sndgca.sbcglobal.net] has quit [[NS] Quit: leaving]
04:07
<@sshine>
I'd like to turn a value of type (Char[A-Z], Char[A-Z], Int[0-9], Int[0-9], Int[0-9]) into an Int[0-(26*26*10*10*10)].
04:25
<&[R]>
https://termbin.com/frgx
04:25 * [R] assumes that aa000 == 0
04:28
<&[R]>
Also your stated range is one greater than the possible number of values
04:29
<@sshine>
[R], ah yes, that was a mistake. OK, thanks, so the thing I was confused about was the '*res *= 26;' part.
04:30
<&[R]>
Which part of it is confusing?
04:30
<@sshine>
that the letters don't occupy a fixed number of bits.
04:30
<&[R]>
The math (*= 26) or the pointer dereferencing (*res)
04:30
<@sshine>
the math.
04:31
<@sshine>
that each 'digit' can have its own number base just by multiplying. :)
04:31
<&[R]>
Okay, so it assumes that you already have a value in there, and that value was for the digits that occupied the string before this call
04:32
<&[R]>
So the proc_n multiplies by 10 because it's got 10 values it could possible have (one being 0)
04:32
<&[R]>
proc_c has to multiply by 26 for the same reason
04:32
<@sshine>
right. it's so smart. :-P
04:32
<@sshine>
thanks!
04:32
<&[R]>
aa == 0; az == 25, ba == 26
04:32
<&[R]>
ab == 1
04:33
<&[R]>
There's probably a more clever way to do things, but IMO that's pretty clear code
04:34
<@sshine>
yes it is!
04:36
<&[R]>
What did you need this for BTW?
04:44
<@sshine>
I'm trying to refactor an exercise at Exercism.io
04:45
<@sshine>
https://github.com/exercism/haskell/tree/master/exercises/robot-name
04:45
<@sshine>
https://github.com/exercism/haskell/blob/master/exercises/robot-name/examples/success-standard/src/Robot.hs
04:45
<@sshine>
it's done in an over-complicated, inefficient way right now.
04:47
<@sshine>
state monad transformers and synchronized mutable variables, and a side-effect is that it'll keep getting slower and slower (the more names that are generated, the more unlikely the function is to terminate).
04:48
<@sshine>
rather than just... represent a name as a number modulo 26*26*10*10*10 and generate a new one by incrementing that number by some arbitrary coprime seed.
04:49
<@sshine>
(rather, using a built-in RNG that guarantees that last stuff.)
04:51 Degi [Degi@Nightstar-acloq1.dyn.telefonica.de] has quit [Ping timeout: 121 seconds]
04:53 Degi [Degi@Nightstar-0kjkva.dyn.telefonica.de] has joined #code
04:58 celticminstrel [celticminst@Nightstar-0p84vo.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
05:31 Derakon is now known as Derakon[AFK]
07:46 VirusJTG [VirusJTG@Nightstar-42s.jso.104.208.IP] has quit [Connection closed]
07:47 VirusJTG [VirusJTG@Nightstar-42s.jso.104.208.IP] has joined #code
07:47 mode/#code [+ao VirusJTG VirusJTG] by ChanServ
10:20 Yossii [Yossii@Nightstar-d7h8ki.org] has quit [Connection closed]
10:26 Yossii [Yossii@Nightstar-d7h8ki.org] has joined #code
11:39 Kindamoody[zZz] is now known as Kindamoody
13:25 gnolam_ [quassel@Nightstar-o3qe20.priv.bahnhof.se] has joined #code
15:08 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
15:08 mode/#code [+qo Vornicus Vornicus] by ChanServ
16:47 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code
18:11
<@TheWatcher>
https://www.shadertoy.com/view/lsKfWd quake first room, in a shader
20:42 Derakon[AFK] is now known as Derakon
21:27 gnolam_ [quassel@Nightstar-o3qe20.priv.bahnhof.se] has quit [[NS] Quit: Gone]
23:36 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds]
--- Log closed Sat Jan 04 00:00:05 2020
code logs -> 2020 -> Fri, 03 Jan 2020< code.20200102.log - code.20200104.log >

[ Latest log file ]