|
Blinkz0rz posted:cases in which you need recursion: ftfy
|
# ? Dec 4, 2016 21:07 |
|
|
# ? May 24, 2024 18:35 |
|
fleshweasel posted: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). Ill try to look through the threading later, but first I gotta go over your C++. First of all, C++ works with just thread_params, no need to specify its a struct. Second, the "new"s are pointless -> this should work just as well C++ code:
|
# ? Dec 4, 2016 21:09 |
|
Blinkz0rz posted:cases in which you need recursion:
|
# ? Dec 4, 2016 21:16 |
|
Blinkz0rz posted:cases in which you need recursion: parsing, if you do it the easy way
|
# ? Dec 4, 2016 21:31 |
|
we did it without any help from the operating system
|
# ? Dec 4, 2016 21:30 |
|
Luigi Thirty posted:we did it without any help from the operating system Sweet.
|
# ? Dec 4, 2016 21:39 |
|
recursion is also cool when you represent state machines as series of function calls; a repeated state just needs to call itself again, and if you get tail call optimization you can implement long-lived state machines that way very easy. lets you do poo poo like: code:
|
# ? Dec 4, 2016 23:36 |
|
LeftistMuslimObama posted:no. we make our own ide in-house that has features for all our extra architecture on top of mumps jfc dude
|
# ? Dec 4, 2016 23:57 |
|
theodop posted:jfc dude not invented here syndrome is great
|
# ? Dec 5, 2016 00:06 |
|
the hilarious thing is that it is 2 layers of "not invented here" syndrome. InterSystems are Not Invented Here: The Company They have invented: 1. like 6 languages 2. their own SQL variant 3. their own ASP clone 4. their own WebForms clone / bizarre MVVM clusterfuck 5. their own standard library 6. their own terrible IDE 7. several web server implementations and this is just from me thinking of the things I've used in like the last week then Epic is looking at this house of cards and thinking "looks great, but what it really needs is another layer on top"
|
# ? Dec 5, 2016 01:36 |
|
oh god there has to be a way to do this generics thing in java without blowing the lid off a c++-level cauldron of type signature nightmares
|
# ? Dec 5, 2016 02:04 |
|
i used recursion once, to merge two xml documents. the code was, needless to say, very bad. took me a while to get it right too i am a v. terrible programmer
|
# ? Dec 5, 2016 02:26 |
|
redleader posted:i used recursion once, to merge two xml documents. the code was, needless to say, very bad. took me a while to get it right too read SICP it's fun & the lectures from the 80s are on YouTube
|
# ? Dec 5, 2016 02:52 |
|
i used recursion recently to walk up a tree, doing the same operation on a node until it reaches a terminator. p much tailor made for recursion but basically the only thing i've ever used it for except fibonacci sequence interview questions
|
# ? Dec 5, 2016 03:08 |
|
Sapozhnik posted:oh god there has to be a way to do this generics thing in java without blowing the lid off a c++-level cauldron of type signature nightmares what do you want to do
|
# ? Dec 5, 2016 03:32 |
|
writing a rest server for my hobby project surprisingly hard to design something good in this space although actually i feel like i've come up with some good designs, i'll probably extract the framework code and upload it to a github repo for ppl to point & laugh at
|
# ? Dec 5, 2016 03:43 |
|
Sapozhnik posted:writing a rest server for my hobby project annotations and reflection. here's a hello world for dropwizard https://github.com/skylinerhq/hello-dropwizard
|
# ? Dec 5, 2016 03:52 |
|
dropwizard is poo poo, it is aimed at the sort of people who would be happier writing python e: not that there's necessarily anything wrong with python, i just don't see the point of writing python in java as opposed to writing python in python
|
# ? Dec 5, 2016 03:54 |
|
Sapozhnik posted:dropwizard is poo poo, it is aimed at the sort of people who would be happier writing python what don't you like about it? it always looked pretty decent, but i'm mostly a c# guy.
|
# ? Dec 5, 2016 04:10 |
|
i used recursion literally all the time in haskell and elm
|
# ? Dec 5, 2016 04:18 |
|
is programming games at all interesting from a hobby project perspective I've never used unity or w/e and I have the artistic skills of a drunken bull moose
|
# ? Dec 5, 2016 04:27 |
|
designing games is fun, and programming a game you've designed is a cool project programming something that vaguely looks like a game without putting any design effort into it is pretty bad though. unless you're making an implementation of a game that someone else put the design effort into.
|
# ? Dec 5, 2016 04:32 |
|
fart simpson posted:i used recursion literally all the time in haskell and elm same, but only through hofs like fold and never explicitly (or as little explicitly as possible)
|
# ? Dec 5, 2016 04:33 |
|
Jabor posted:designing games is fun, and programming a game you've designed is a cool project hm alright
|
# ? Dec 5, 2016 04:33 |
|
ok, so i guess im wrong about that. thanks for the lies compilers teacher. i guess i just find all the divide-and-conquer algos to be way easier to picture mentally with recursion, but i was never taught the iterative versions so everything i know about them is my own bodged-together understanding. how does the iterative version of something like, say, merge sort work? you just make to subarrays, push them onto a stack, then pop the stack and repeat? i feel like i'd gently caress that up my first couple of tries but i should probably implement some toy algos like that just to get a feel. i hate that my job has very little to do with algorithms.
|
# ? Dec 5, 2016 05:00 |
|
easiest approach is generally to replace the implicit stack that you'd build with recursive calls with an explicit stack which can be stored somewhere other than the call stack
|
# ? Dec 5, 2016 05:06 |
|
mergesort in particular has predetermined partitions so you only really need to track where you are in the process, you don't need to keep a stack of which partitions have been sorted or anything. but yeah in general for things like tree algorithms you essentially replace the recursive calls with "add this to the list of things to do" and then put it all in a loop that starts with "get the next thing to do"
|
# ? Dec 5, 2016 05:08 |
|
i should probably learn some of those basic cs algorithms lol
|
# ? Dec 5, 2016 05:09 |
|
Jabor posted:mergesort in particular has predetermined partitions so you only really need to track where you are in the process, you don't need to keep a stack of which partitions have been sorted or anything. neat. and all the sorting algos get mixed up in my head because sorting is trivial in my lang, so i just remember that they're mostly "break array in half, do thing". i remember when i was a kid learning programming out of books and whatever i would always use linked lists for everything even if i had to roll my own because i was scared shitless of doing math on arrays, lol. my lovely text adventures were so god damned slow.
|
# ? Dec 5, 2016 05:15 |
|
hmmmm trying to figure out how to wrap my tilemap around so I don't get the jumping when we run out of room to draw one screen is 14 rows of 20 tiles and I've got a bitplane big enough to store 28 rows of tiles. at the start of a frame I can set the graphics pointer to read at any point in the bitplane. the scrolling is just moving the pointer up by one scanline each frame. I think what I need to do is draw each new row of tiles twice, once on each half of the screen so 14 rows apart. then when I reach the end of the bitplane I can reset the pointer to the bottom half of the bitplane and keep drawing as if nothing has happened (the colors are wrong because I don't have masking set up right)
|
# ? Dec 5, 2016 05:31 |
|
redleader posted:i should probably learn some of those basic cs algorithms lol ehh the only times you'll ever find yourself actually implementing any of them is in a programming interview, which should tell you something. it is very rare that you'll need to care about what exact kind of sort your language's standard library sort is performing. (heap sort is the best general purpose sort though, for the record)
|
# ? Dec 5, 2016 05:37 |
|
interviews, like cs programs, focus on the least relevant issues (like algorithms) instead of vastly more important but difficult to quantify or directly address skills like architecture, design, debugging, learning new technologies or systems, dealing with people, googling for answers,
|
# ? Dec 5, 2016 05:45 |
|
Bloody posted:interviews, like cs programs, focus on the least relevant issues (like algorithms) instead of vastly more important but difficult to quantify or directly address skills like architecture, design, debugging, learning new technologies or systems, dealing with people, googling for answers, is dick size comparison ever relevant in these interviews?
|
# ? Dec 5, 2016 05:49 |
|
it kinda seems that "basic cs knowledge" would be something of a prerequisite for any interesting/challenging/novel work but then i remember where i live and the dearth of any jobs like that and go back to my usual state of ennui
|
# ? Dec 5, 2016 05:53 |
|
Sapozhnik posted:(heap sort is the best general purpose sort though, for the record) assuming you're not joking, why do you say that? i thought timsort was the most common standard library generic sort.
|
# ? Dec 5, 2016 05:54 |
|
i only know how to do things recursively. i write c using goto
|
# ? Dec 5, 2016 05:55 |
|
LeftistMuslimObama posted:is dick size comparison ever relevant in these interviews? dick presence usually is unfortunately
|
# ? Dec 5, 2016 06:01 |
|
Fergus Mac Roich posted:assuming you're not joking, why do you say that? i thought timsort was the most common standard library generic sort. I mean if you're no-poo poo writing a standard library then go with whatever insanely complicated hybrid adaptive sorting algorithm you can, I suppose. if you just want something O(n log n), period, and not "oh well the worst case is O(n^2) but really it's more like O(n log n) in practice faaaart" with no auxiliary space requirements then that's literally just heap sort and nothing else afaik. and it's still fairly simple.
|
# ? Dec 5, 2016 06:11 |
|
you can do in-place mergesort if you're clever about it
|
# ? Dec 5, 2016 06:19 |
|
|
# ? May 24, 2024 18:35 |
|
Sapozhnik posted:I mean if you're no-poo poo writing a standard library then go with whatever insanely complicated hybrid adaptive sorting algorithm you can, I suppose. point taken about the ease of implementation. i was considering that perhaps stability might be a more common requirement than no extra space, but if we're already in an environment where some kind of Arrays.Sort() method isn't available, maybe memory is that big of an issue. Jabor posted:you can do in-place mergesort if you're clever about it http://thomas.baudel.name/Visualisation/VisuTri/inplacestablesort.html wow it's stable too, that's neat.
|
# ? Dec 5, 2016 06:24 |