« first day (1416 days earlier)      last day (3525 days later) » 

8:05 AM
I think that raw memory arrays are in many ways inferior to hashing maps working on (coordinate, elem)
I've noticed I tend to use the latter way more.
 
Arrays are overrated.
Hash tables ftw!
 
I'd say it's memory and cpu cycles vs convenience
if you put it that way, it becomes pretty obvious
 
I wish Array[T] extends Map[Int, T].
 
there's one issue though
Arrays guarantee continuity of keys, and maps don't
 
An array is in essence a map with sequential integral keys.
I like how in Clojure contains? checks whether a vector contains the given index rather than the given value.
I dislike however that they don't act like maps with all the other functions.
 
8:09 AM
@PolymorphicPotato I am using Point as my key
 
You can write something that acts like a map but stores the things more efficiently.
Like a 2D array.
Abstraction!
 
morning fart faces
 
morning epic loser
smell the disappointment.
 
it's weird to think about a game map as an association from position to value
 
@PolymorphicPotato It's all around me, I wish I could just get used to it.
@BartekBanachewicz what do you mean?
 
8:16 AM
@BartekBanachewicz I did that because it was easier to deal with than 2D arrays. XD
 
'position to value'?
 
Because no language I know other than C# implements 2D arrays nicely. XD
 
@thecoshman my game array uses 2d points as keys and I am wondering about switching to hash map
 
So I just went with {[0 0] :grass, [1 0] :stone, [2 0] :stone, [0 1] :stone, _#etcetera}.
 
yeah I have the same
 
8:18 AM
@BartekBanachewicz I see...
I presume you don't want to be dealing with floating point positions
or is this only for the map data?
 
@thecoshman no, my index type is defined on integers
data Point = Point Int Int deriving (Show, Eq, Ord)
instance Ix Point where
    range ((Point minX minY), (Point maxX maxY)) = [(Point x y) | x <- [minX .. maxX], y <- [minY .. maxY]]
    inRange ((Point minX minY), (Point maxX maxY)) (Point x y) = and [x >= minX, y >= minY, x <= maxX, y <= maxY]
    -- implemented the same as default (a,b) Ix instance
    index r@((Point l1 l2), (Point u1 u2)) p@(Point i1 i2) | inRange r p = index (l1,u1) i1 * rangeSize (l2,u2) + index (l2,u2) i2
                                                           | otherwise = error "Out of range"
the implementation is pretty funny
 
If you write a data type that acts like a Map (Int, Int) Tile then you can easily use it.
And it can be efficient.
 
I am not sure how I could write it though
 
I think you want something like Clojure's vector.
But I don't know what it's called in Haskell.
 
I think I'm not going to be concerned by it until I need better performance
 
8:24 AM
Sequence (Sequence Tile)
 
@BartekBanachewicz that looks like madness o_0 Haskell I presume?
 
Sequence has O(log(min(i, n - i))) update and retrieve.
 
@thecoshman yep. And the index implementation is really stolen from GHC's tuple Ix implementation
 
For [] they're O(n) obviously.
 
you might need to wrap the underlying data structure, that could be something like Map(int, Map(int, ~data~))
 
8:26 AM
Map is O(log n) I believe.
 
trying to access a fundamentally 1D data structure as 2D is never going to be perfect.
 
@PolymorphicPotato hm
 
memory is 1D
 
@StackedCrooked coincidental
 
Memory is Map (Ptr Word8) Word8 :D
 
8:28 AM
> Vector is a "better" Array
@StackedCrooked implementation details
I'm reading this
79
Q: Haskell: Lists, Arrays, Vectors, Sequences

r.sendeckylearning my Haskell, I read a couple of articles regarding performance differences of Haskell lists and (insert your language)'s arrays. Being a learner I obviously just use lists without even thinking about performance difference. I recently started investigating and found numerous data structu...

 
@BartekBanachewicz Yeah, but it's either mutable or has O(n) update.
 
so does Array
 
Vector has a nicer API.
 
I don't care about O(n) update I tink
@PolymorphicPotato I'm not using Array API directly anyway. I'm using Lenses
 
Kinda like std::vector vs C-style arrays.
 
8:29 AM
@BartekBanachewicz Lenses?
 
changeMap = (ix end . unit .~ aUnit) .
            (ix start . unit .~ Nothing)
 
Not indented far enough.
@thecoshman a lens is basically (getter, non-mutating setters).
 
@thecoshman a very abstract way to access data
 
@PolymorphicPotato non-mutating setters? you mean a setter that returns a new version of the data structure that now has change?
 
8:31 AM
well there are state-based lens operators
 
You can make index n a lens which would have a getter Sequence a -> a and a setter Sequence a -> a -> Sequence a.
 
so... is the idea you can have one data structure, a list say, and then use multiple lenses to access depending on the current usage?
 
@BartekBanachewicz Yeah, but they are just syntactic sugar over get and put.
 
do you tie the data to a particular lense?
 
@thecoshman it's mostly about composability
@thecoshman the lenses operate on typeclassed data.
 
8:32 AM
@BartekBanachewicz of these lenses?
 
@thecoshman You could e.g. compose them, so you can make a lens that gets or sets the name of the first child of the second person in a list.
 
@BartekBanachewicz so the lense is tied to particular data format, but is an instance of that data format tied to one lense?
 
@thecoshman no. Lens is something like a "path" through the data
but, say, an ix lens will work on everything that's indexable
 
... I'm sure if I just tried using them it'd make sense.
 
8:35 AM
@thecoshman my code above composes an ix lens to get to some index in an array, then updates unit field in it
my array is Array Point { unit, city, fieldType }
if say City had a field "name", lens for that would compose:
 
Why the fuck is YouTrack using 200% CPU.
 
(ix (Point 0 0) . city . name .~ "Cityville")
 
@PolymorphicPotato because you visualizer is bad
 
Well it'd need another lens to handle Nothings too but you get the idea
 
@BartekBanachewicz is the full stop member access, and the the dot tilde setting that member?
 
8:38 AM
Full stop is lens composition, .~ returns a setting function.
 
lol
nice job
 
@thecoshman (f . g)(x) = f ( g ( x ) )
 
I see...
 
8:51 AM
Argh.
 
eh setting a maybe field requires traversing the Maybe
 
It's so annoying that there is nothing like C#'s using with AutoCloseable in Scala's library.
 
kinda makes sense when you think about it
 
@BartekBanachewicz Maybe a -> a -> Maybe a
 
@PolymorphicPotato that's value_or
 
8:53 AM
It's a setter for a lens!
 
Xeo
@BartekBanachewicz No, that'd be Maybe a -> a -> a
 
@Xeo oh right
8
A: Composition of partial lenses

Edward KmettYou can use over (inner.traverse.foo) to write to the nested field. This will not report failure the way you want though, because it succeeded in mapping over all 0 targets. traverse (from Data.Traversable, re-exported by Control.Lens) here gives you a Traversal for walking over the Maybe. You ...

 
maybeLens = lens id (flip (<$))
 
yeah you want Applicative here I think
Well Ed used monadic %%~ somehow I think
 
(<$) is great.
 
8:55 AM
failover was added to the lens already
> Try to map a function over this Traversal, failing if the Traversal has no targets.
so maybeValue & fieldAccessor `failover` fieldModifier should leave Nothing if it finds Nothing
 
> A conforming compiler is allowed to emit code that blows your legs off.
lol.
 
Hmm. If you have mempty and (<$) can you implement Applicative in terms of those?
Nah.
 
Xeo
There is some kind of monoidal Applicative version
 
@shaikh Please refer to the lengthy discussion we had here, originally (I wonder how you missed that? ) Also, didn't you say "I tried this"? — sehe 54 secs ago
Grummble. Fuck.
 
9:03 AM
:D
 
:)
hm I should probably start working
nobody is still there so I was planning on reading with my morning coffee, and it's suddenly an hour gone :S
 
Like it happens
 
Hello
 
Yello
 
9:14 AM
@ThePhD what do you mean "finished"?
 
@Xeo Applicative is a kind of monoidal functor. Everything is monoids! (Were you thinking of Alternative?)
 
Ooooh. C++ UG meeting in September is lightning talks again.
Gotta think of something.
 
Monoid m => Applicative (Const m)
wait that's backwards
 
Nov 15 '10 at 19:26, by sbi
*Some advice for newcomers* here:
You can edit your messages for 2mins. Try the `v` arrow to the left of it. You can edit your last messages using `cursor up`, `escape` cancels this.
Markdown sort of works here, pretty much like in comments. However, by design, it fails for multi-line messages.
Many links to some special sites (all SE site, Wikipedia, Twitter etc.) will inline an excerpt of the page linked to, *when they are the only text in a message*.
Reply to others using the familiar @syntax. Reply to specific messages by clicking on the little down-right arrow appearing at its very rig
 
9:29 AM
No gif?
 
Found this instead
 
it's directed at @ThePhD who will know what I'm talking about; too lazy to scroll up to find the thing to refer to shrug
 
The gif is a bit hard to find in search. Solomon.
Wait.
It didn't work.
 
Works now.
Probably needed to get cached?
 
@Xeo @StackedCrooked @ThePhD Akame ga kill is getting ridiculous with the yesterday's episode
 
Xeo
9:43 AM
@ScarletAmaranth Hm?
@LucDanton Well, I remember there being two definitions of an Applicative
 
Yup.
 
@Xeo you don't find the entire love thing rather... strange :D?
 
Xeo
@ScarletAmaranth I don't watch the anime, so I don't know what happened that episode. :P I only read the manga
Which love thing do you mean?
 
aaah; the martial arts tournament
with Esdeth "choosing" the main guy like a pokemon
 
Xeo
ah
I thought it was funny
and leads to some interesting situations later on
 
9:50 AM
@Xeo Seen the link I posted some days ago? The one showing what I needed has_exact_match for?
 
Xeo
Uhm, I think no?
 
Xeo
@Griwes aha
 
10:15 AM
I am tempted to #define real_auto auto const&
or something.
 
auto&& superior
 
Xeo
Just ignore that you can mark classes final. — Xeo 10 secs ago
 
0/10 advice
I think it's time for operation Rapptz needs a gold badge.
12 answers that manage to get 42 total score
doesn't sound too bad
 
Xeo
@Rapptz The premise "is callable in any way" is broken anyways, so whatever
 
10:31 AM
yet somehow, it works
 
Xeo
it does - but I don't see what benefit that check brings you
 
I'm aware.
 
Xeo
That is_callable doesn't cope with overloads or templated operator() anyway. — Puppy 25 secs ago
@Puppy it does
 
yeah it does
 
Xeo
It just doesn't tell you anything useful - only "this type overloads operator()"
 
10:34 AM
don't see how
 
I showed it in this room at least a year ago.
 
his attempt to take the address of the operator should fail when it doesn't produce a single unambiguous overload.
 
Xeo
@Puppy Yes, and that's the trick.
 
oh is he
 
TVars are scary
 
Xeo
10:36 AM
Notice that the "fallback" is the yes case
and the no overload is only selected in case it can unambiguously identify fallback::operator()
 
o_0 I think... at some stage I may want this wee project to have meta-meta-data...
 
Good ole using fun = void(*)(); operator fun();.
 
Xeo
Alias!
 
woo TMVar is a nice thing
 
Both versions are bad. It should be for(i = 0; i < NUMBER_OF_STEPS; i++). Don't use magic numbers. — glampert yesterday
that's bad too!
can't have that magic 0
 
Xeo
10:43 AM
0
Q: Can't make a derived instance of Num

Ammlan GhoshI am using ghci, this code section newtype Gold = Gold Int deriving (Eq, Ord, Show, Num) is showing the error as Can't make a derived instance of 'Num Gold': 'Num' is not a derivable class Try GeneralizedNewTypeDeriving for GHC's newtype-deriving extension in the newtype declaration f...

 
> for many common uses it might be simpler to think of it as a single-element queue used for a communicating producer/consumer pair.
 
Xeo
ugh
 
for(i = BEGINNING_STEP; i < END_STEP; ++i)
much better
 
bad constant name
no caps - they are for macros
oh, it's a C question - nvm
 
Xeo
What the fuck do you do with such blatant "I can't even be arsed to read the error" questions?!
 
10:46 AM
@Xeo lmao
 
Xeo
Error Message shows: Can't make a derived instance of 'Num Gold': 'Num' is not a derivable class Try GeneralizedNewTypeDeriving for GHC's newtype-deriving extension in the newtype declaration for 'Gold' — Ammlan Ghosh 47 secs ago
....
 
> This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting.
 
> This question should be closed because the OP just doesn't get it.
 
@AmmlanGhosh Yes, we know that. Did you actually bother to try this solution? — milleniumbug 50 secs ago
 
10:50 AM
Guise, my current signup/signin system is the following: A staff member fills the registration form (name, email, phone number) and the system sends an email to the user containing either a link to set a password (to login with email/password credentials) or a link to access with either google, facebook, twitter or yahoo accounts for which the primary email is the one given at registration. Is that too complicated?
Any feedback?
Also morning
 
tl;dr going to sleep
gl
 
night
 
@Jefffrey what are your users logging in to?
 
A website where they can book appointments, medical visits, exams, stuff.
 
Before I go to bed
 
10:53 AM
> Set the value of returned TVar to True after a given number of microseconds
waaaaait
is that setInterval in disguise? :D
 
33
Moderatorsmoderators.stackexchange.com

Beta Q&A site for people building, administering, managing and cultivating digital communities

Currently in public beta.

Terrible stats
 
Thank you @MathematicalOrchid. I am very new to Haskell. Actually I didn't include the line {-# LANGUAGE GeneralizedNewTypeDeriving #-}. — Ammlan Ghosh 42 secs ago
 
@milleniumbug Ouch, I am impressed it took him only that many attempts at trying to understand what both GHC and the answer were telling him...
 
Actually, no, it should just skip compilation of Boost Locale. Alternatively, you can use the hint I commented 2 days ago: Alternatively, try to boostrap with --without-icu (of course, only if you don't need the advanced features in Boost Locale)sehe 57 secs ago
Am I being dense? I don't get what's not to get. Or maybe his system is completely broken
@Jefffrey HIPAA?
 
11:11 AM
@sehe Health Insurance Portability and Accountability Act?
 
Ugh, itertools.groupby is so so bad.
What a horrible, broken function.
> The operation of groupby() is similar to the uniq filter in Unix. It generates a break or new group every time the value of the key function changes
WHYYYYYY
> Because the source is shared, when the groupby() object is advanced, the previous group is no longer visible.
WTFFFFFF
So basically to make it useful you have to write your own function:
def groupby(xs, key):
    xs = sorted(xs, key=key)
    return {k: list(vs) for k, vs in itertools.groupby(xs, key)}
 
@Jefffrey Yeah, I know, Italy. But still, EU has similar laws
@PolymorphicPotato because anything else could not be made deferred/lazy?
@PolymorphicPotato Pay for what you need also lives in Python. This is AGoodThing(TM)
 
11:31 AM
C++ has no builtin zip, right?
 
4
Q: Data Compression Algorithms

starboxI was wondering if anyone has a list of data compression algorithms. I know basically nothing about data compression and I was hoping to learn more about different algorithms and see which ones are the newest and have yet to be developed on a lot of ASICs. I'm hoping to implement a data compre...

 
of course not
 
in Discussion between shaikh and sehe, 1 min ago, by sehe
@shaikh Why would you do that? Are you going to try without-icu and ithout-icu as well?
3
Oh god. Someone stop me
@Puppy lol
 
@sehe Someone is wrong at the Internet?
 
@VáclavZeman Oh I can handle wrong.
in Discussion between shaikh and sehe, 22 mins ago, by shaikh
I tried "./bootstrap.sh -without-icu", but still the "./b2 install" fails with above errors. Please help... its wasting a lot of my time
 
11:38 AM
Oh.
 
"You cannot initialize a class variable when declaring it" is a very strange remark, seeing how you go on to show exactly how to do that. — sehe 9 secs ago
 
I don't see how initializing it in the init list is declaring it.
 
You have either the patience or the attention span of a goldfish
@Puppy Hint: if you "don't see", it might be because you "don't look"
(You might want to remove a downvote)
 
Xeo
Hmm....
Wait, why does it show the 1TB one
tch
 
5400rpm?
do they still make those?
 
11:47 AM
yeah, the faster the drives spin, the more it should act like a gyroscope and stabilize itself, right?
 
Xeo
@BartekBanachewicz nice and silent
 
@sehe Don't believe I did. Let me check.
 
@melak47 lol
 
I did not.
 
Actually I do admit I haven't been following the HDDs for like 1 year I think.
 
11:52 AM
@Puppy You "did not." what?
 
@BartekBanachewicz 8 TB soon! at even more outrageous prices than the 6 TB drives now
 
I wonder when will 1TB SSDs get reasonable prices
 
They already have tweakers.net/pricewatch/340877/samsung-840-evo-1tb.html $390 is reasonable
 
@BartekBanachewicz I can't find any info on the hdd used by current gen consoles
but I'd bet money it's 5400rpm
 
someone should plot $/GB cost over the last 3 years for both technologies
 
11:53 AM
@BartekBanachewicz I bet someone already has :D
 
someone should plot $/hit PP cost over the last 3 years
 
@melak47 some competing vendors already have. Different trends :)
 
@sehe downvote anybody.
 
> SSD prices stabilize, but capacities are rising
 
11:54 AM
@Puppy Ah good. That's why I said "might"
 
@BartekBanachewicz jeez that spike.
 
floods in Thailand, I think.
 
^ this
 
yeah, I remember.
WA to the rescue
 
Xeo
@melak47 that seems wrong?
 
11:58 AM
pro tip: it's showing the price of Simpson per GB
 
Xeo
k, whatever
 
the price of The Simpsons per GB
 

« first day (1416 days earlier)      last day (3525 days later) »