« first day (741 days earlier)      last day (4205 days later) » 

12:00 AM
Yeah, it'd be nice to not waste money on those but unfortunately it'll never happen because people are idiots and thickheaded.
 
@Rapptz You're clearly not looking very hard. There are lots of things that waste tax money. A few years ago I saw a study (sorry, no link handy) where they concluded that every level you go "up" in the government, about 10% more of the money that goes in is completely wasted. i.e., about 10% of city taxes, 20% of county taxes, 30% of state taxes, and 40% of federal taxes.
 
@Rapptz You are so naive. Nothing the government does is cost effective. They pay many times more than private industry to do the same work.
 
@Chimera I know for a fact that isn't true but I don't have a link on me to disprove it.
@JerryCoffin Possibly. I did say "off the top of my head". Not to mention that military makes up a large chunk of our spending.
 
@Rapptz Just check the salaries of government employees and compare them to their private company equivalents.
 
@Chimera Like? At least give me an example.
 
12:05 AM
@Rapptz Yes, but they weren't even talking about things like the military that people can argue about -- at least not all of the military budget. They were talking about things like Army/Air Force/Navy bases that stay open even when the DoD says they should be closed, but they stay open because they happen to be in the district of some particularly powerful congressman.
 
That article is a few years old, but the trend remains the same.
 
So you suggest to just make everything in the hands of private companies?
 
@Rapptz No, you asked for evidence of governmental waste and I gave it to you.
 
these are my includes I set up for sublimeClang...still it can't even find stack!
http://pastebin.com/Y5ZAzUBV
 
@Rapptz (A) not everything (B) it's a common belief.
 
12:10 AM
@Chimera Ah, well it was an interesting link actually.
Though I still don't fully agree with it for just one reason.
 
how do I call a member function inside a for_each if its not static?
 
The solution shouldn't be to outsource the jobs into private companies but to cut the wages if you feel they're too high. I can't exactly judge their incomes because I have no idea what their position entails or how much work they're doing.
 
@rogcg oh you mean
 
@MooingDuck A common belief that?
 
@Rapptz security.blogs.cnn.com/2012/10/09/… "Army's chief of staff Gen. Raymond T. Odierno told Congress earlier this year.... If the Pentagon holds off ...making new tanks...it can save taxpayers as much as $3 billion." "173 House members - Democrats and Republicans - sent a letter April 20 to Defense Secretary Leon Panetta, urging him to continue supporting their decision to produce more tanks."
 
12:12 AM
@Cheersandhth.-Alf std::for_each(errors.begin(), errors.end(), printError);
 
@Rapptz that as much as possible should be privatized.
 
try a bit of fun, like, std::mem_fun
i never recall the names of those
 
@MooingDuck Thanks for proving my point?
 
@rogcg bind(&T::foo, _1) (with additional placeholders/values if needed) with your favourite library that provides a bind.
 
@Rapptz that the government is wasting 3 billion dollars buying tanks the army doesn't want?
 
12:13 AM
@MooingDuck Did you even read what you replied to?
 
@LucDanton huh, why not lambda?
 
@Rapptz "There are very few things that are a waste of tax money." Buying tanks nobody wants is definitely a waste of tax money
 
@Rapptz I didn't say anything about privatizing parts of what the government does. My point is that the evidence shows the government pays it's employees twice than the equivalent private sector employee. It's not an opinion, it's a fact.
 
@MooingDuck Read the second sentence..? Cherry picking much?
 
@Rapptz whoops, didn't process the whole sentence. sorry
 
12:15 AM
@Cheersandhth.-Alf If it's C++11 I don't know what to advise. There are some clamoring that std::for_each is obsoleted by range-for, others that like that the bounds of the range are explicit when passing first and last iterators. I don't have much of an opinion myself.
 
@Chimera I didn't say you did. I was proposing a solution to the problem.
 
posted on October 25, 2012 by Michael from Redmond

With the introduction of Windows RT for ARM devices, many Windows software developers will be encountering ARM processors for the first time. For the native C++ developer this means the potential for running afoul of undefined, unspecified, or implementation-defined behavior--as defined by the C++ language--that is expressed differently on the ARM architecture than on the x86 or x64 architectur

 
@LucDanton i'd go for the range based for. much less clutter. and now supported by visual c++ (as of version 11).
 
So who needs a lambda :p
 
Even though I technically have no idea what the hell they do or what the comparison even is. It seems like a black/white comparison.
How much are the private company's top people earning? Are the employees underpaid?
 
12:19 AM
i think the difference between political directions is mostly (1) who do i consider to be in my tribe, (2) how far into the future do i think it's reasonable to plan for, and (3) how insane am i (like, religious)
but others disagree
jerry pournelle once listed like 40 dimensions or so
 
lol, a lot, and I do mean a lot of those have to be highly correlated or else the space is just too big to make sense of.
 
The Pournelle chart, developed by Jerry Pournelle (in his 1963 political science Ph.D. dissertation), is a 2-dimensional coordinate system which can be used to distinguish political ideologies. It is similar to the Political compass and the Nolan Chart in that it is a two-dimensional chart, but the axes of the Pournelle chart are different from those of other systems. The two axes are as follows: * The x-axis, "Attitude toward the State" (labeled Statism), refers to a political philosophy's attitude towards state and centralised government. The farthest right is "state worship", and...
ok, so the main diff between my 3 points and above, is that above chart does not consider the ideology's time horizon on planning
 
I don't think the 'rationalism' axis maps to 'how insane am i'.
 
and the reason i know about this silly stuff is because i once used to read BYTE magazine, and also the books co-authored by Jerry Pournelle and Larry Niven
i agreed with Jerry's opinion that true multitasking was just silly and that all one really needed was the ability to switch between tasks (with one running task at a time)
 
now I just need to know how to use boost regex lib.. but only regex.. I dont want to use all that stuff..

this can help me to extract only the regex lib? http://www.boost.org/doc/libs/1_51_0/tools/bcp/doc/html/index.html
 
12:26 AM
oh noes
building boost with g++ has always failed me
and regex is one of those you have to build, if i recall correctly
 
what if I want to use only regex? what to I do?
 
there is a facility in boost for extracting only what you need
but it isn't perfect
 
bcp?
 
you may have to add some headers to set manually
i don't recall the name
you'll find it
 
std::regex isnt good enough?
 
12:28 AM
doesn't work with g++
 
aghh
 
only with visual c++
 
is boost the only aproach
?
 
no
but i'd say just go at it
use half an hour studying bjam build system
 
this will take me a good time. hehehhh
 
12:29 AM
yes
 
whats with bjam stuff?? whats this
 
it's the boost build system
very flexible
but therefore also pretty counter-intuitive and difficult to fix things when they go wrong
per murphy's law, things will go wrong
 
user142019
The best build system is Cabal.
 
user142019
Followed by shell scripts.
 
@Cheersandhth.-Alf LOL
@Cheersandhth.-Alf do u have a good link for me to follow, or just the default boost docs?
 
12:31 AM
just the docs
 
@WTP'-- I heard cabal has dependency hell
 
...\gcc\mingw32\4.7.0\include\c++\type_traits:257,39 - Error - use of undeclared identifier '__float128'

>_>
 
user142019
@Pubby Never had any problem with it and dependencies.
 
I like normal makefiles
 
@melak47 sounds like a long double. why are you using that?
 
12:35 AM
@Cheersandhth.-Alf I'm not
 
"I like Make when it works."
 
I should be programming for android now. but Im here working with this c++ stuff..
 
BLARGH.
 
user142019
BRAIN Y U NO GOOD IDEA FOR WEB APP
 
12:37 AM
@rogcg I mean.. you could use NDK to write parts of it using c++, which would combine your two "non related" interests
 
@Cheersandhth.-Alf it's in his type_traits header
 
@refp maybe some day..
 
user142019
@melak47 UB, but maybe it works:
 
user142019
using __float128 = double;
#include <type_traits>
 
user142019
But yeah, it’s terrible to do such a thing.
 
12:42 AM
which is better approach. create .h files or .hpp?
 
user142019
I always use .hpp so text editors get the language right and it’s immediately clear to people what language the file is in.
 
inb4 .h++
 
@melak47 Where did you get MinGW from?
 
user142019
@Rapptz the Internet.
 
@Rapptz well, I tried just about a billion different ones
 
12:43 AM
but is there something related to support like in c++03 or c++11
 
@melak47 Did you try this one
 
user142019
MinGoneWild
 
@Rapptz nope, I shall
 
I use that and it works just fine. Just make sure to pick the MinGW one not TDM-GCC when you get to choose because I've never picked the TDM-GCC one.
 
.....could've told me sooner :D
 
12:47 AM
This is brilliantt!!!

Most Boost libraries are header-only: they consist entirely of header files containing templates and inline functions, and require no separately-compiled library binaries or special treatment when linking.
 
@melak47 I'm sure it works.
I've just never used it.
 
@Rapptz well..
looking good, so far
eh, close but no cigar
...lib\gcc\mingw32\4.7.1\include\c++\type_traits:257,39 - Error - use of undeclared identifier '__float128'
 
What are you trying to compile? I wanna see if it fails for me too
 
hello world, basically
with clang though
not gcc/g++
 
Ah. I don't use Clang. See no reason to.
 
12:51 AM
I would have liked it to work in sublime so I can use sublimeClang :3
 
If you're compiling with Clang why is it giving you a MinGW error?
I thought you could only use Clang with Cygwin
 
huh..
I have no idea
bunch of sites told me to get mingw32 and then clang 3.1 though
 
boost doc is kinda odd
 
Weird. I don't know enough about Clang though sorry
 
If using Clang with libstdc++ it's not surprising that the error points to those directories.
 
12:55 AM
hmm...well, '#define __float128 bool' makes that particular error go away *don't hit me*
but it still leaves the rest
 
Can you pastebin your errors?
 
#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
  template<>
    struct __is_floating_point_helper<__float128>
    : public true_type { };
#endif
That's what it's complaining about
 
@Rapptz __float128 isn't implemented, or something
 
Yeah.
 
12:58 AM
but...where do I go from here :p
 
undef GLIBCXX_USE_FLOAT128?
 
@LucDanton tried that :p
 
#undef _GLIBCXX_USE_FLOAT128 if __clang__ is what the link suggests.
 
I've seen that, but
>The fix Sami mentioned works only when _compiling_ glibc with clang
 
1:00 AM
Ah.
 
there's a diff for a "fixed" type_traits too, but I don't even know if it's for the same version of it..
 
Is this really specific to -std=gnu++11?
 
I dunno
 
Have you tried -std=c++11?
 
well applying that fix gets rid of the error. (so did #define __float128 bool :P)
but it leaves all these still
http://pastebin.com/jsDmjfmf
 
1:03 AM
Which fix? -std=c++11?
Damn.
 
nah,

-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
+#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) && !defined(__clang__)
 
I feel like this is a lot of effort just to get Clang working.
To patch up files I mean.
Why are you getting Boost errors anyway?
 
@Rapptz well, the thing I want to compile does use boost
 
Ah. I thought it was weird to use boost for hello world.
 
well after fixing that one bug, I went back to the full thing
 
1:08 AM
@Rapptz That install has a lot more problems than we can catch. A clue is "A site told me to install this stuff" That stdlib is quite possibly worse scripted than a Burt Reynolds movie.
 
@Rapptz Support for Windows is experimental.
 
@LucDanton it shows :p
 
I'd rather stay with GCC then =|. At first I wanted to use Clang for the nicer errors but I figured GCC would be easier to "install" on windows.
So SublimeClang is autocompletion for obj-c and co?
 
@Rapptz yeah, only care about c++ though
 
What does it autocomplete?
 
1:13 AM
member fields, functions, stuff
 
@Rapptz Any samples for nicer error messages? I think they are getting better and better, even when involving templates.
 
@CaptainGiraffe Nah. It was a long time ago. The errors are nice now. :P
 
Have you windows coders ever tried out the gnu tools on a linux/unix box?
 
Yes ofc!
 
It's actually very liberating. Everything just works.
 
1:16 AM
Except gdb.
 
lol
 
@melak47 Why don't you add the auto completions yourself?
 
@Rapptz I don't think you can call it auto completion if you type it yourself :p
 
@CaptainGiraffe Visual Studio also "just works". But only with .NET.
 
1:18 AM
@melak47 in vim everything is auto complete =)
@EtiennedeMartel The experience is a lot different. I did some MFC coding, back in the days, when I was still unviolated. Then of course VS was a necessity.
 
@CaptainGiraffe But it's only from a list of keyword, not code analysis like Intellisense.
 
@Cicada Not at all.
 
@Rapptz how is that going to help? sure I can add a trigger for "x.m" -> "x.member" or something, but what if I need a "y" ?
 
MFC :(
 
Completely. There is no code analysis whatsoever in Vim.
 
1:20 AM
@Rapptz nvm
 
Just keyword scanning.
 
@CaptainGiraffe Ah, I see what your problem is. It begins with M and ends with FC.
 
@EtiennedeMartel Is it Maberfc?
 
'merican fried chicken
 
Or My KFC ?
 
@EtiennedeMartel I'm sorry to bring in profanities, but that was just a part of my experience.
 
@melak47 huh? I get that kind of autocompletion automatically lol
 
What a douche, I posted something asking if the code would be available because I couldn't find it... and it was removed...
 
The fuck is Codekana. lol just saw the gif.
 
@EtiennedeMartel :D
 
1:23 AM
Also the language aware tools are a very modern invention. 3 years ago even intellisense was a poor hack. Now netbeans can infer complex relationships in php scripts.
 
Aren't most of these issues fixed in VS2012?
I still think IntelliSense for VS2012 gets a lot of hate here. :(
Maybe it's because I've always used vanilla and noticed the differences a bit more.
 
Well I think it could be better than it is
 
@Rapptz well, take for example a WNDCLASSEX struct. autocomplete lists all kinds of things...DWORD, WinMain, NULL, RegisterClassEx, but not the actual elements of the struct
 
Also I have a complaint about VS2010, delegating constructors is a very simple thing to implement. And a very useful thing to have. Why_no_delegating_ctors_VS.jpg
 
dontfuckinguseunderscoresmotherfucker.gif
 
1:26 AM
@Cicada That was hard to read. Try again please.
 
It's probably a habit from the Windows 3.11 days.
 
@CaptainGiraffe Are they? They are among the last features being implemented.
 
@LucDanton Any insight as to why?
 
well, I guess that's it then. no autocomplete.
Unless I feel like writing my win32 code on linux >_>
 
@melak47 :(
 
1:28 AM
@CaptainGiraffe No.
 
@LucDanton Worst case scenario is to construct an unnamed constructor doing that work.
No just laziness
 
What work?
 
delegating
 
Wouldn't that mean implementing delegating constructors via delegating constructors?
 
No it would mean implementing delegating constructors through a well known mechanism
 
1:32 AM
Have you taken into account that a delegating constructor may be defined out of line?
 
No that would make stuff more complex.
The A::A():A(int) though should be promptly allowed in the MS compiler
 
1:48 AM
So many things you'd think they'd have implemented, but... no. Just.... nothing.
Emptiness.
So much No No No No No No No No No all over the list.
Makes me really wish I was using GCC.
 
@ThePhD guess that's the price we pay for intellisense? :p
 
Intellisense, as fun as it is, is an IDE extension, not a C++ compiler core feature.
 
@ThePhD but people don't use MSVC for c++11 features :p
 
Sigh.
Makes me want to shred my current accepted internship offer at MS and reapply to get into the C++ Compiler team.
I'll write in support for that shit myself.
 
hehe
I just spent hours trying to get clang/mingw/gcc to work on windows so I could get some autocompletion in sublime text.
 
1:56 AM
@EtiennedeMartel what is that -- mechanics? i thought it was a music video
 
I wish I could take GCC compiler and smash it together with the VS IDE.
The resulting combination would probably be orgasmic.
 
@ThePhD well the compiler teem over at maicrosoft is hard at work doing all they can to get more c++11 features, because that's what the users have requested
and STL is hard at work improving the STL
 
It just seems weird that a solution you'd usually shell out thousands of dollars for your company to use is less-well-equipped than the one that comes bundled with every Linux distro ever.
 
and they have the chairman of the international C++ committee as lead architect
i think re features they're very pragmatic at doing what they think the users need most
but they fail in evaluating what the users need most
and there's one thing that baffles me
namely that very ungood design decision such as the vs2012 look, only need a reasonable-sounding rationale that almost any child can see doesn't really hold water, while getting things fixed or implemented, needs massive user requests and discussion
 
Meh. I'm not so sure why so much time was spent overhauling the VS look. I hated 2008, liked 2010, and 2012 is just like "Oh.... kay? You spent all this time making sure everythin fit these themes? Was it really worth it?"
It just feels weird, going over that list and seeing a vast disparity of features between GCC and VC when the one thing that made VS amazing was feature-fullness of IDE and compiler, even if it was nonstandard-extensions.
 
user142019
2:36 AM
Anyone here proficient with Python? I want to create a write-only property but I have no idea how.
 
user142019
Oh got it.
 
user142019
def _set_password(self, password):
    # Logic
    pass
password = property(None, fset=_set_password)
 
2:51 AM
Write-only props are probably a silly idea
 
@ThePhD I'm pretty sure the compiler group is quite separate from the IDE group, so time/effort spent on the IDE has little or no impact on the compiler. It seems to me that since VS 6, the IDE has basically been a lot like a child's top: if you look closely, it's spinning very fast -- but if you back off and look at the big picture, you see that most of it is just spinning in place, with small, erratic movements that have gotten it nowhere (half counteracting the other half).
 
user142019
@CatPlusPlus I find them useful for passwords; you can set them (and they’ll be encrypted), but you can’t get them back.
 
Yeah, you get back the hash
That doesn't make the property write-only
 
user142019
That would be called hashed_password then. :)
 
(It's a silly property)
 
user142019
2:58 AM
user.password = 'lol123'
user.hashed_password == '$2a$12$f6.hsVbQyL6lQAWRIQwirO0wODF35VKUOQA1mfldgtjOjR9fIMIzS'
 
@WTP'-- You seem to be looking for a simple function that takes a string and returns its hash.
 
user142019
I want the User class to be responsible for encrypting and storing the password.
 
user142019
Not the one that mutates the user object.
 
user142019
(Because that can happen in multiple places, and I don’t want to repeat code.)
 
instead of a property, just do a member function set_password
much more intuitive
you don't want to store the cleartext password
 
user142019
3:02 AM
I don’t store the plain text password.
 
user142019
I’m not an idiot.
 
Xeo
Crap. LWS is down...
 
well then, then it's not logical to pretend that (notationally) one is assigning the cleartext to a data member
 
user142019
So something like hash_and_set_password.
 
@Cheersandhth.-Alf It's a bit from a relatively old Quebec movie.
 
3:03 AM
oh. so it's french they talking.
but the late erik naggum had a nice idea
why do the username/password distinction at all?
after all you need both items to log in
 
Xeo
0
A: How to say != 0-9 in c ++

Yanick RochonFor the C++ answer, look at this question which has already solved a quite similar problem, that you can very easily adapt to your situation. As for Java, you can do this : public boolean isInteger(String s) { return s.matches("^[0-9]+$"); } You can modify the regex to suite your requirem...

 
so why not just have one
 
user142019
@Cheersandhth.-Alf Because otherwise you have a problem on the sign up page, which must give an error if you create an account with a username that is already registered.
 
Xeo
Regex for checking if a character is between 0 and 9. o_ô
 
user142019
Usernames must be unique, after all.
 
3:06 AM
@WTP'-- easy to solve. i challenge you to solve that.
 
user142019
@Cheersandhth.-Alf TME; I’ll go with username/password which every user on the planet is familiar with and they won’t get confused.
 
user142019
What you are suggesting is like using an SSD icon rather than a diskette for a save button.
 
user142019
But it might be possible to do what you were suggesting.
 
except, another norwegian, petter hesselberg, had this nice idea
 
user142019
3:08 AM
With splitting the string in two parts, for example.
 
user142019
But that would be weird.
 
why have a save function, at all?
why not, when you work on something, it's there, always persistent?
 
user142019
@Cheersandhth.-Alf Hehe on OS X they are placebo menu-items in some applications.
 
user142019
They do nothing when you click them. They just highlight.
 
user142019
They could have taken them out completely, but that’d annoy all the 50 ⌘S/minute people.
 
user142019
3:11 AM
Meh.
 
user142019
I want to save a user in a database. So I have a User class.
 
user142019
Should I make the save function a member function of User or a free function?
 
at one time it was popular to focus on knowledge and responsibility in designs
then you can ask, is it reasonable for a User to know about a Database?
 
user142019
No, not at all.
 
user142019
It’s basically a struct that automatically hashes the password. That’s it.
 
3:17 AM
well i don't know of course. but if not (as you say), then a member function is contra-indicated. or the db needs to be abstracted
 
user142019
It does have an id member, though, which is the ID of the user in the database.
 
user142019
But, I could return a tuple (string, User) from the get_user_from_db function, the first element being the ID.
 
hm i gotta go
pretty sure e.g. jerry or the cat can help further :-)
or etienne or xeo
 
user142019
haha okay
 
user142019
Later.
 
3:19 AM
guyz hi, i'm confused, how to pass this to system() function? so i want to open cmd and there automatically to ping xx.xx.xx.xxx -t -l xxxxx ?
 
With a spoon.
 
user142019
system("ping xx.xx.xx.xxx -t -l xxxxx");?
 
^ this, afaik
 
Xeo
0
Q: building a chess bot

user1753377i want to build a application that can automatically move pieces on a chessboard.(during online play) this is an example of the type of application i want to build. Chess Bot Example the author of the program says on his website that this is how the application works: It determines the locati...

NARQ or not constructive votes, please.
 
All I can do is downvote ;(
 
3:22 AM
@WTP'-- uu thanks) it works. i thought i should use strinstream etc.
 
user142019
It’s off topic, not constructive, not a real question and too localized. What a terrible question.
 
So many reasons to choose
Which one can I takeeeeeeeee (It's Friday, Friday... Everybody's down on Friday)
 
user142019
But coming back to my question.
 
user142019
If I have struct User { string ID; string Username; string Email; string HashedPassword; }, which represents a user.
 
user142019
I’m confused on whether or not I should make save() (which stores the user in the database) a member function or a free function.
 
user142019
3:25 AM
The user object doesn’t really care about the database, but it does have an ID field.
 
As Meyer's says, if it doesn't need to be a member function, don't make it one.
 
user142019
import user
the_user = User()
user.save(the_user)
 
Does he have a bajillion types?
 
user142019
But the database doesn’t care about users.
 
user142019
It only cares about dumb data.
 
user142019
3:27 AM
lol
 
@MartinJames Really? I mean, in the event he has a bajillion types to save that makes a lot of member functions...
Then again if he has a bajillion types there's something wrong ...
 
That's essentially a serialization question, right?
Whose responsability it is to actually serialize something?
 
What is doing the saving? The DB is.
 
That's like saying it's the file's job to do the serializing.
 
user142019
db = pymongo.Connection()['mydatabase']

class UsersCollection(object):
    def __init__(self, db):
        self.collection = db['users']

    def save(self, user):
        # magic
        pass

users_coll = UsersCollection(db)
users_coll.save(user)
 
3:29 AM
Python... In lounge C++ o.O
who am i kidding when do we even talk about c++ xD
 
user142019
Python is C++++.
 
user142019
But the above may make sense.
 
It's one of the few languages we tolerate.
 
I'd have to say, I agree with @EtiennedeMartel's point about responsability.
 
user142019
It translates between the database’ data and users.
 
user142019
3:31 AM
But it feels so Java-ish to have a class for it. :P
 
user142019
> class UserDatabaseMapper
 
I'm not saying that some intermediate class would not be appropriate.. I guess that what I'm saying is that it's not the job of the User class to perform the guts of the saving - something else should SQL it, stream it to file, send it somewhere, whatever.
 
user142019
It doesn’t have to be a class necessarily, but something needs to keep track of the database connection. Of course I could pass to every function every time.
 
user142019
Ah I’ll go with the UserDatabaseMapper class. I can always change it later.
 
user142019
Anyway, I’m gonna sleep.
 
user142019
3:35 AM
Thanks for the help!
 
@WTP'-- Yes. The User class should not be the one that decides how it is going to be saved.
 
Okay, my turn: I need a constexpr modulo.
 
@LucDanton OK - someone else's turn!
 
The trick is that I want negative (left) operands to still map to [0, n) when doing modulo n. Always assume n positive.
Haskell has both mod and rem, heh.
 
Xeo
@LucDanton The negative thing should be rather easy with constexpr unsigned mod(int i, unsigned n){ return mod_impl((i < 0 ? -i : i), n); }, right?
 
3:47 AM
That's not right, that makes the image symmetric around 0. E.g. the image of [-3 .. 3] of modulo 3 with your implementation is [0, 2, 1, 0, 1, 2, 0].
I want [0, 1, 2, 0, 1, 2].
t < 0 ? (t % u + u) % u : t % u is what I have right now for the record.
@Xeo Apparently your implementation is top left. I need one of the two other ones.
 
Xeo
@LucDanton That's not how normal % works, however, is it? [0 .. 3] % 3 would be [0, 1, 2, 0]
 
@Xeo I'm missing a 0 to the right to make that image complete. Since it's the image of [-3 .. 3] the image of 0 is indeed 0, right in the middle.
 
Xeo
@LucDanton Yeah, I meant the suffix 0
But yeah, makes sense to want the negative numbers to yield the same order as the positive ones. Would be easier if you operated on whole lists, as you could reverse the negative part and send them through the mod function after that.
 

« first day (741 days earlier)      last day (4205 days later) »