|
BigRedDot posted:Python doesn't have matrices. The third party library NumPy has arrays, which are different things than matrices (obviously), for the reason that they are incredibly useful. (i.e., the person that wrote NumPy made a thing that solved the problem they had in front of them, instead of some different problem, go figure.) Python has a dedicated operator for matrix multiplication but it doesn't have matrices?
|
# ? Jan 22, 2016 11:08 |
|
|
# ? May 14, 2024 07:46 |
|
qntm posted:Python has a dedicated operator for matrix multiplication but it doesn't have matrices? It has a dedicated operator that you can override in your own implementation of matrices, but it doesn't have a standard implementation. They only added it recently, I guess because people who wanted to do matrix maths in Python asked them to.
|
# ? Jan 22, 2016 11:16 |
|
What's the difference between a matrix and a list of lists?
|
# ? Jan 22, 2016 11:20 |
|
Illegal Move posted:What's the difference between a matrix and a list of lists? Well, among other things, in a matrix each list in the list must have the same length.
|
# ? Jan 22, 2016 11:21 |
|
qntm posted:Well, among other things, in a matrix each list in the list must have the same length. Also, the types of operations you do on matrices benefit tremendously from adhering to certain implementation details regarding contiguous memory storage, unlike lists of lists which are can be strewn about. There are also considerations for strides, views, and other fiddly bits you don't get out of simple [[1,2,3],[4,5,6],[7,8,9]]. (You could implement those operations on top of them, but at that point you may as well just go whole hog). (Also, in practice you can also implement sparse matrices where you use the fact that it has known dimensions to not have to explicitly mention zero values).
|
# ? Jan 22, 2016 11:27 |
|
Hammerite posted:This is why I've never been particularly wooed by those ultra-nerdy text editors Linux people use, vim and emacs and what have you. Advocates go on and on about how quickly they can move around a file and edit but I never feel like how quickly I can edit the file is a bottleneck, it's how quickly I decide on the right thing to do. It's not about editing faster for the sake of it. An efficient editor lets you get right to the next bit of thinking without breaking your chain of thought.
|
# ? Jan 22, 2016 11:28 |
|
They've all got C in the name, must be the same language! And the author's an MBA so he must be good at programming!
|
# ? Jan 22, 2016 11:36 |
|
C/C++/C#/Cobol
|
# ? Jan 22, 2016 11:42 |
|
Jsor posted:C/C++/C#/CSS
|
# ? Jan 22, 2016 15:34 |
|
This would be a cool book if it showed a language feature of C, how they tried to improve it in C++, and how they succeeded in improving it in C#.
|
# ? Jan 22, 2016 15:35 |
|
Is it a bad thing that every one in a while I do this: git commit -m "$(curl -s whatthecommit.com/index.txt)" ?
|
# ? Jan 22, 2016 15:41 |
|
Go all in, include the -a.
|
# ? Jan 22, 2016 15:43 |
|
feedmegin posted:They've all got C in the name, must be the same language! And the author's an MBA so he must be good at programming! I'm eagerly awaiting his Java/JavaScript followup.
|
# ? Jan 22, 2016 15:50 |
|
Soricidus posted:It's not about editing faster for the sake of it. An efficient editor lets you get right to the next bit of thinking without breaking your chain of thought. I've recently started using Emacs again (It was my first editor when I was learning unix, like, 20 years ago) and set up with a whole bunch of useful add ons (including the nav sidebar. Why thats not standard I'll never know) and with my chord memory starting to return, Its a loving lightning bolt to use. I mean sublime text is cool and all, but emacs really is a tight piece of software. And in 2015 "Omg it uses 8mb of ram" isn't exactly the memory hog it was in the 90s.
|
# ? Jan 22, 2016 15:53 |
|
Yeah, I use vim not because I think it's stylish to use an incomprehensible text editor, but because it lets me edit text without having to think about it and without having to use my mouse. You know how when you're playing videogames you don't think "okay, jump, that means I need to press the jump button", you just think "jump" and your body does the appropriate action? The controller "disappears" and your thoughts lead directly to action. The really good text editors let you do that with composition and editing as well. More WYSIWYG editors have a (much) shallower learning curve, but because they rely on the mouse to do anything especially complicated, you're never going to get the same level of flow out of them that you can out of the oldschool editors with their massive libraries of control commands.
|
# ? Jan 22, 2016 17:26 |
|
As Heidegger would say, your text editor should be ready-to-hand.
|
# ? Jan 22, 2016 18:13 |
|
Oh a vim vs emacs vs everything else discussion. I would love to be a vim or emacs pro, but every time I've tried them, I've always struggled with projects larger than a few files. Refactoring variable names or moving classes around are a few activities which are extremely simple in the JetBrains IDEs I use, but I've never found a way of doing anything like it in vim. Also, just configuring vim and installing plugins seems to take at least 10x longer compared to IntelliJ or even Atom. For example, I know that if I want to write haskell in Atom, all I need to do is open settings and search the packages for haskell and install anything that looks useful, but for vim I expect my first step would be to open a browser and start googling for what I need, which just seems way less efficient. I feel like the gains I would get from faster text editing in vim are completely negated by how much slower it is to actually get to the editing.
|
# ? Jan 22, 2016 18:32 |
|
Illegal Move posted:Oh a vim vs emacs vs everything else discussion. Okay yeah, vim is not an IDE. If you want good text editing in an IDE, you install the vim or emacs editing tools into the IDE, rather than try to transform the text editor into an IDE. EDIT: replacing variable names in vim: Switch to command mode and do "%s/\<oldVariableName\>/newVariableName/g" (without the quotes) to do a search-and-replace. Add a "c" at the end to ask for confirmation with each replacement. The \< and \> ensure that you only get the complete "word" of the old variable name, so e.g. if you have a variable "size" that you want to replace, you won't accidentally mangle the variable "sizes" that's in the same file. TooMuchAbstraction fucked around with this message at 18:49 on Jan 22, 2016 |
# ? Jan 22, 2016 18:35 |
|
I would argue that if renaming variables or shuffling classes around is a significant part of your job, the problem isn't your editor. As for the plugin problem, I don't even know what that means. After you get syntax highlighting (and vim ships with rules for just about every language), what else is there?
|
# ? Jan 22, 2016 18:37 |
|
SurgicalOntologist posted:As Heidegger would say, your text editor should be ready-to-hand. That is a great framing. xzzy posted:I would argue that if renaming variables or shuffling classes around is a significant part of your job, the problem isn't your editor. I rename and reshuffle all the time, as the use of something shifts slightly, or the center of logic-mass shifts within a class hierarchy. It works out better than letting the maintenance chores pile up and turn into a renovation.
|
# ? Jan 22, 2016 18:45 |
|
xzzy posted:As for the plugin problem, I don't even know what that means. After you get syntax highlighting (and vim ships with rules for just about every language), what else is there? Tons of stuff. I have a very lightweight vim configuration and still have plugins for autocompletion and showing the git diff in the line number gutter. I guess whether you find plugins useful depends on where you want to draw the line between portability (since not all vim installs will have your special snowflake setup) and creating a personalized IDEish experience for yourself.
|
# ? Jan 22, 2016 19:04 |
|
xzzy posted:I would argue that if renaming variables or shuffling classes around is a significant part of your job, the problem isn't your editor.
|
# ? Jan 22, 2016 19:06 |
|
TooMuchAbstraction posted:EDIT: replacing variable names in vim: Switch to command mode and do "%s/\<oldVariableName\>/newVariableName/g" (without the quotes) to do a search-and-replace. Add a "c" at the end to ask for confirmation with each replacement. The \< and \> ensure that you only get the complete "word" of the old variable name, so e.g. if you have a variable "size" that you want to replace, you won't accidentally mangle the variable "sizes" that's in the same file. This just sounds like a dreadful idea. Why would I want to do that when I can just go to where the symbol is defined, retype it, and then accept my IDE's offer to replace the old name with the new one everywhere that's appropriate? It's simpler and the IDE is contextually aware so it won't (for example) change the word "size" in a string literal, or a variable "size" in a different namespace. And echoing the sentiment that if you don't rename and restructure things as you work on them then either you are spookily good at working out up front exactly how your programs should be structured, or you're not taking a step back and second-guessing yourself enough.
|
# ? Jan 22, 2016 20:22 |
|
I'm not an IDE user. Can IDE's search and replace expression patterns with replacements?
|
# ? Jan 22, 2016 20:42 |
|
Hammerite posted:This just sounds like a dreadful idea. Why would I want to do that when I can just go to where the symbol is defined, retype it, and then accept my IDE's offer to replace the old name with the new one everywhere that's appropriate? It's simpler and the IDE is contextually aware so it won't (for example) change the word "size" in a string literal, or a variable "size" in a different namespace. If you're in an IDE, use the IDE's tools, of course. That note was for more general "how do I X" vim usage. That said, I doubt that an IDE is going to be able to fully replace a pattern-based search-and-replace. I've done some ridiculous things with vim.
|
# ? Jan 22, 2016 20:45 |
|
Well, like, most automatable refactorings seem to be of that nature. For example if I want to replace foo(x, y, z) with foo(blah(x.t), y, z), because foo takes a different type and the conversion with blah is correct (it used to be inside foo) -- can one not do this in an IDE?
|
# ? Jan 22, 2016 20:47 |
|
is there a widely held belief that ides don't have regex replacement
|
# ? Jan 22, 2016 21:02 |
|
sarehu posted:I'm not an IDE user. Can IDE's search and replace expression patterns with replacements? Yes. I would have a hard time believing that vim or whatever can do anything that a decent IDE can do when it comes to functionality. I mean you might have preferences about keyboard shortcuts or whatever, but as far as what it can do to your code...
|
# ? Jan 22, 2016 21:02 |
|
I like using emacs because I work with a bunch of different languages and it means I don't have to have three different editors open at once, plus I get basically the same interface when I work remotely.
|
# ? Jan 22, 2016 21:11 |
|
IDE regex replacement is usually not nearly as powerful or easy to use as vim/emacs', though. And personally I like emacs because it's sort of like an OS-agnostic shell. I can get terminals in there, a bunch of apps that work great in text-mode are in there, and since my config is synced across all my machines I get the same experience on any machine after a couple of git clones.
|
# ? Jan 22, 2016 21:14 |
|
sarehu posted:Well, like, most automatable refactorings seem to be of that nature. For example if I want to replace foo(x, y, z) with foo(blah(x.t), y, z), because foo takes a different type and the conversion with blah is correct (it used to be inside foo) -- can one not do this in an IDE? Usually stuff like resharper is better about refactoring than just doing regex replacement. Regex can blow up if say two classes have the same method names, and you only want to change the name of one of the methods, or you do something like change a method to a property - resharper will only rename the method of the class rather than all strings with that method name.
|
# ? Jan 22, 2016 22:18 |
|
I'm not talking about regex at all. I'm talking about AST patterns, replacing foo(X,Y,Z) with foo(blah(X.t),Y,Z) where the only replacements happen are the ones that resolve to a specific function foo. Or I guess those that did resolve but are now broken, if you changed foo first...
|
# ? Jan 22, 2016 22:43 |
|
I don't know of any that even let you search on AST expressions, let alone replace them.
|
# ? Jan 22, 2016 22:45 |
|
Subjunctive posted:I don't know of any that even let you search on AST expressions, let alone replace them. i'd qualify that with granular control over the search/replace. when i search for a method named fartz in intellij, rename it to buttz, and have it drop the second parameter from all call sites (and clean up any unused variables that have resulted) then i am most certainly searching over the backing AST that intellij has built up.
|
# ? Jan 22, 2016 23:47 |
|
I just haven't witnessed this productivity boon from command line text editors. I haven't had the opportunity. I see a lot of people jumping on the command line text editor train, then having to google whenever they need to do something they forgot the key combo for because the tool they're using is basically user-hostile and has zero discoverability. I am sure someone out there has all the key combos in their head like a goddamn Mozart of code and manipulates text very quickly. I'm still skeptical that it's that big of a benefit when we all would likely benefit from writing less code and thinking more in our industry anyway. That is to say, how fast you can type is probably not your limiting factor as a programmer. IDEs and GUI text editors have keyboard shortcuts. Lots of them have pretty powerful keyboard based text manipulation. Visual debugging is a tremendous quality of life improvement over command line debugging as well. brap fucked around with this message at 01:18 on Jan 23, 2016 |
# ? Jan 23, 2016 01:15 |
|
FamDav posted:i'd qualify that with granular control over the search/replace. when i search for a method named fartz in intellij, rename it to buttz, and have it drop the second parameter from all call sites (and clean up any unused variables that have resulted) then i am most certainly searching over the backing AST that intellij has built up. Sure, I just mean that you can't really give it an AST expression like the one described above, meaning something like "calling B with a parameter of the member X of type Y". It will search for certain kinds of symbols, but not syntax patterns AFAICT. I haven't looked at the intellij source to see what it uses to back that operation up, but I'd naively have guessed that it was just a set of indexes rather than an AST. That's interesting. (I don't know what "granular control" actually means.) E: fleshweasel posted:I just haven't witnessed this productivity boon from command line text editors. You mean like sed? Nobody edits at the command line, they just use editors that are rendered with different UI symbols. Emacs doesn't change capabilities when you pop it out into a Quartz window (and you can have a menu bar and mouse support even with it inside a terminal window).
|
# ? Jan 23, 2016 02:16 |
|
fleshweasel posted:I just haven't witnessed this productivity boon from command line text editors. I haven't had the opportunity. I see a lot of people jumping on the command line text editor train, then having to google whenever they need to do something they forgot the key combo for because the tool they're using is basically user-hostile and has zero discoverability. I used emacs/xemacs pretty much exclusively for 20+ years, and it's my go-to text editor for everything except c, c++, and java, but wow is it not a ton of fun for editing multiple files at once.
|
# ? Jan 23, 2016 02:40 |
|
fleshweasel posted:I just haven't witnessed this productivity boon from command line text editors. I haven't had the opportunity. I see a lot of people jumping on the command line text editor train, then having to google whenever they need to do something they forgot the key combo for because the tool they're using is basically user-hostile and has zero discoverability. This is basically how you learn to use the tool in the first place. After you know the fundamentals, learning consists of identifying something that's slow/annoying to do the manual way, and then determining a faster way to do it. If it's something you do often, you usually don't have to look it up again. Expecting people to be immediately more productive without first learning how to use the thing in the first place is kinda dumb. It'd be like having an experienced programmer switch from C to Java and then wondering why they're not suddenly more productive and are instead spending half their time looking up APIs. quote:I am sure someone out there has all the key combos in their head like a goddamn Mozart of code and manipulates text very quickly. I'm still skeptical that it's that big of a benefit when we all would likely benefit from writing less code and thinking more in our industry anyway. That is to say, how fast you can type is probably not your limiting factor as a programmer. My programming time typically alternates between thinking of the best way to achieve something, and then mechanically turning that headspace design into actual code. The faster I can do the latter, the more time I can spend on the former. If you're a multitasking savant that can focus on both the thinking and the typing at the same time then more power to you, I guess. quote:IDEs and GUI text editors have keyboard shortcuts. Lots of them have pretty powerful keyboard based text manipulation. Visual debugging is a tremendous quality of life improvement over command line debugging as well. If you think that using vim or emacs means you have to use command-line gdb instead of a graphical debugger, you're completely wrong.
|
# ? Jan 23, 2016 05:11 |
|
Vim to me is just a set of keybindings. Which is great because everything under the sun seems to have some version that ports in those keybindings. Even things unrelated to programming.
|
# ? Jan 23, 2016 08:19 |
|
|
# ? May 14, 2024 07:46 |
|
I don't know if you've ever used emacs because to say that it has "zero discoverability" suggests that you've never touched it. Yes, emacs has some crazy keyboard shortcuts for you and you can of course assign your own to things you do a lot. But it also has, essentially, a command line (M-x) which lets you type some words which you think might describe the task you want to do, and it helpfully shows you the keyboard combo for those commands (if one exists). I have a lot of things in my emacs that I only access through that interface. Imagine if, instead of hunting through menus to find the option for "open debugger window" (was that in View, or Window, or Debug? Which submenu of those menus might it be in?) you just typed "debug window" and every command that contained those words showed up. Wondering what a certain variable in the editor does, or a function, or whatever? There's a help page for it. It's trivial to document any of the extensions, which is why it calls itself a "self-documenting text editor". Yes there's a learning curve. every editor has one. I just decided to invest that time and energy into an editor which so far has stood the test of time and will probably still be around and still have a working version for whatever OSes we're using in 20 years. Assuming we're still editing text then, I guess. I still use Visual Studio for C# and I still use Xcode for Swift because yes those are much better integrated with the development workflows for their languages, but those aren't the only text files I ever have to manipulate. Emacs works with Clojure like a dream. And occasionally I need to edit a configuration file, in XML or some other format. I'm sure as hell not doing that in visual studio.
|
# ? Jan 23, 2016 12:23 |