|
fleshweasel posted:c tp s: can someone help me just use your hand
|
# ? Dec 3, 2016 08:35 |
|
|
# ? May 24, 2024 06:25 |
|
Bloody posted:nah not super noice they generally wind up not hiring me lmao me in an interview "we want you to write a function that returns all possible combinations of a list of lists, any language" so like, any? echo {a,b,c}{d,e,f} in bash stuff "yes any language" ok, here's it in prolog: comb([],[]). comb([H|T],[X|O]) :- member(X, H), comb(T,O). i only found out later that one of them left the interview and asked around the office to find someone who knew prolog to check it
|
# ? Dec 3, 2016 09:01 |
|
"can u reverse a linked list" ok here it is in python using tuples, i think the free-list + refcounting will ensure that it's effectively fixed memory usage "what" no seriously, ugh do you want it in another language "yes" fine here is a java one
|
# ? Dec 3, 2016 09:03 |
|
tef posted:me in an interview lol
|
# ? Dec 3, 2016 09:09 |
|
tef posted:me in an interview
|
# ? Dec 3, 2016 09:30 |
|
ooh! ooh! now do APL! edit: Rosetta code to the rescue: pre:A[I]←1+I←(0⍷A)/⍳⍴A←('FIZZBUZZ' 'FIZZ’ 'BUZZ' 0)[2⊥¨×(⊂3 5)|¨1+⍳100] eschaton fucked around with this message at 10:40 on Dec 3, 2016 |
# ? Dec 3, 2016 10:35 |
|
c Java s: Netbeans just told me that I will have an infinite recursion and it was right. If it keeps being helpful, I might actually start liking it.
|
# ? Dec 3, 2016 12:44 |
|
recursion? uh, this is the terrible programmer thread
|
# ? Dec 3, 2016 12:56 |
|
eschaton posted:no see this should tell you that you're doing something entirely wrong by even thinking of using popen this is kind of my point. you want to do a high level thing in c, and there's a convenient, obvious, high level function that does almost what you want, but not quite, and also it's got other serious flaws that mean you shouldn't use it anyway. so you're left flailing around in a sea of hard-to-use primitives, each of which introduces more exciting gotchas.
|
# ? Dec 3, 2016 13:14 |
|
anthonypants posted:i'm going to guess from their reaction that you did not get the job, or hopefully that you did not accept that job i needed money and worked there until i was made redundant after 11 months, during that time i had seven different managers and three written warnings (all dismissed) http://thedailywtf.com/articles/The-Difference-Between-Better-and-Less-Bad may run very close to the original environment for screen scraping. i wrote a python replacement and somehow convinced a MSSQL/C#/Windows shop to deploy a linux/python web service they still use my code, or at least in a ship of theseus way, almost 9 years on
|
# ? Dec 3, 2016 18:00 |
|
what does "key" mean in sql/innodb? like, not "primary key" or "foreign key", just "key". is it just an index? specifically the ones here this is loving impossible to google because of everything talking about primary or foreign or whatever keys
|
# ? Dec 3, 2016 18:07 |
|
from the mysql doc for the create table syntax KEY | INDEX KEY is normally a synonym for INDEX. The key attribute PRIMARY KEY can also be specified as just KEY when given in a column definition. This was implemented for compatibility with other database systems. so yeah it seems it's just another way to say index. "normally" anyway, whatever that means
|
# ? Dec 3, 2016 18:14 |
|
how do I find remote contract work I want to make side cash
|
# ? Dec 3, 2016 19:50 |
|
how is it this hard to save a drat 48x32 rectangle into a memory buffer and load it back again each frame with the Amiga blitter aaag
|
# ? Dec 3, 2016 22:24 |
|
c Java s: Java enums are sweet. Not being able to make ArrayList<int> less so. Having to reason about this messJava code:
|
# ? Dec 3, 2016 22:44 |
|
Xarn posted:c Java s: Java enums are sweet. Not being able to make ArrayList<int> less so. Having to reason about this mess ouch. I generally take deeply nested collections like this and write a goddamn class that represents the actual thing you're working with instead of the data structure used to store it. it's not 1996 any more, adding another class isn't going to hurt performance.
|
# ? Dec 3, 2016 22:51 |
|
redleader posted:recursion? uh, this is the terrible programmer thread 'doing a recursive implementation when there's a perfectly good imperative solution' is primo terrible programmer territory
|
# ? Dec 3, 2016 23:22 |
|
eschaton posted:I still don't understand how Python has taken off here rather than Maxima maxima's for symbolic manipulation but these eigenvectors aren't going to find themselves
|
# ? Dec 3, 2016 23:25 |
|
Xarn posted:c Java s: Java enums are sweet. Not being able to make ArrayList<int> less so. Having to reason about this mess isnt type erasure fun???
|
# ? Dec 4, 2016 00:58 |
|
fritz posted:'doing a recursive implementation when there's a perfectly good imperative solution' is primo terrible programmer territory the recursive solution is sometimes easier to reason about and if your language has a non-lovely compiler they will get optimized into the same thing anyway.
|
# ? Dec 4, 2016 01:30 |
|
LeftistMuslimObama posted:the recursive solution is sometimes easier to reason about and if your language has a non-lovely compiler they will get optimized into the same thing anyway. well, it will if it's tail-recursive. i don't know of many compilers that will transform a recursive algorithm into an iterative one with an explicit stack.
|
# ? Dec 4, 2016 02:22 |
|
i optimized my tail calls by putting your moms number on speed dial
|
# ? Dec 4, 2016 06:39 |
|
uncurable mlady posted:i optimized my tail calls by putting your moms number on speed dial quoting a post from 2014
|
# ? Dec 4, 2016 06:50 |
|
LeftistMuslimObama posted:the recursive solution is sometimes easier to reason about and if your language has a non-lovely compiler they will get optimized into the same thing anyway. If its able to optimize general recursion into iteration, thats some mighty fine compiler you've got there. I needed to generate all bitmasks of length N with exactly k bits set.
|
# ? Dec 4, 2016 08:15 |
|
uncurable mlady posted:i optimized my tail calls by putting your moms number on speed dial
|
# ? Dec 4, 2016 08:26 |
|
Soricidus posted:ouch. I generally take deeply nested collections like this and write a goddamn class that represents the actual thing you're working with instead of the data structure used to store it. it's not 1996 any more, adding another class isn't going to hurt performance. Thats what I am doing, but first I gotta unravel this mess. --- edit --- There are also 5 more similar collections in that class and that is after I split the original monster class into 3 logical units that aren't overly interconnected. Xarn fucked around with this message at 09:12 on Dec 4, 2016 |
# ? Dec 4, 2016 09:03 |
|
Xarn posted:Thats what I am doing, but first I gotta unravel this mess. how long until you get pulled up for spending time refactoring instead of hacking new features x, y and z in?
|
# ? Dec 4, 2016 10:17 |
|
c++'s const correctness stuff seems pretty cool on the surface
|
# ? Dec 4, 2016 11:27 |
|
redleader posted:c++'s const correctness stuff seems pretty cool on the surface Yup. Its infectious though, which can make introducing it in existing codebase painful. Its also a massive pain to provide all the right overloads without using const cast, if the logic is nontrivial: C++ code:
|
# ? Dec 4, 2016 12:26 |
|
FamDav posted:quoting a post from 2014 mods never made it thread title... a shameful mods
|
# ? Dec 4, 2016 15:35 |
|
c Java s: Erased generics can still go suck a dick.
|
# ? Dec 4, 2016 15:47 |
|
whats the point of lvalue reference qualified member functions?
|
# ? Dec 4, 2016 15:58 |
|
Illusive gently caress Man posted:whats the point of lvalue reference qualified member functions? So you can specify different behaviour for lvalues vs rvalues. In reality there are some use cases, but so far this is quite obscure, so I don't have any examples of people using this in their libraries handy.
|
# ? Dec 4, 2016 16:40 |
|
LeftistMuslimObama posted:the recursive solution is sometimes easier to reason about and if your language has a non-lovely compiler they will get optimized into the same thing anyway. lol
|
# ? Dec 4, 2016 16:52 |
|
worrying about recursion compilation at the whiteboard is premature optimization
|
# ? Dec 4, 2016 17:15 |
|
i have found that recursion in programming is great for programs about mathematics like induction with peano numbers and as an idiomatic way to process lists in scheme-like langs. one of the lambda papers notes that there is an isomorphism between peano numbers and s-exps, which explains why it feels natural to program that way in scheme. racket has better and more powerful ways to process lists that are named like they are imperitive things like for/list, for/set, the syntaxes aren't explicitly recursive but they might be macros over a recursive something. but thats my idiot spare time opinion, at work i use java and have only found one use-case for recursion: linearizing a list of javafx tree items entries. the tree represents a ui menu, so the assumption is that the walk won't take a significant portion of the heap.
|
# ? Dec 4, 2016 18:21 |
|
tps: what am I misunderstanding about std::thread such that running my workload with 1024 threads is faster than running it with 2 threads on a dual core machine? it's just computing a mandelbrot set by dividing up rows of pixels to compute amongst threads.
|
# ? Dec 4, 2016 19:46 |
|
fleshweasel posted:tps: what am I misunderstanding about std::thread such that running my workload with 1024 threads is faster than running it with 2 threads on a dual core machine? it's just computing a mandelbrot set by dividing up rows of pixels to compute amongst threads. More info needed, there is nothing weird in std::thread and Mandelbrot set an IO bound task aint.
|
# ? Dec 4, 2016 20:06 |
|
I'm representing the bitmap with a std::vector<std::vector<int>> which could be bad. I pass a pointer to the vector in with the thread start arguments for each thread as well as the index into the outer vector that the thread should start inserting into the inner vector. I ran it with Instruments on macOS which made it look like half of my time is being spent in cabs though (absolute value of a complex number). I feel like there's probably something really stupid going on causing threads to block each other or something. Running it with 2 threads is actually slower than my single threaded implementation without std::thread. posting code because why the gently caress not code:
|
# ? Dec 4, 2016 20:22 |
|
|
# ? May 24, 2024 06:25 |
|
cases in which you need recursion:
|
# ? Dec 4, 2016 20:23 |