|
fritz posted:was Delphi like pascal where arrays of different lengths were different types rust has this today
|
# ? Aug 4, 2015 02:50 |
|
|
# ? Jun 5, 2024 06:08 |
|
fart simpson posted:rust has this today are you serious
|
# ? Aug 4, 2015 02:57 |
|
yes, but it also has "slices" into an array which are variadic size
|
# ? Aug 4, 2015 03:20 |
|
quote:My cohort Mike Mika and I were porting Klax, the arcade tile matching game, to Game Boy Color. It was a fun, intense, six-week project to bring one of our favorite games to the system. Jesus
|
# ? Aug 4, 2015 03:23 |
|
An array is a collection of objects of the same type T, stored in contiguous memory. Arrays are created using brackets [], and their size, which is known at compile time, is part of their type signature [T; size]. let xs: [i32; 5] = [1, 2, 3, 4, 5]; let ys: [i32; 6] = [1, 2, 3, 4, 5, 6]; these are different types
|
# ? Aug 4, 2015 03:24 |
|
eschaton posted:what design? fart simpson posted:An array is a collection of objects of the same type T, stored in contiguous memory. Arrays are created using brackets [], and their size, which is known at compile time, is part of their type signature [T; size].
|
# ? Aug 4, 2015 03:50 |
|
fart simpson posted:rust has this today c++ does too, and so does c kind of, with weird syntax that no one uses (int foo(int bar[static 3])), except pointers just get coerced
|
# ? Aug 4, 2015 04:08 |
|
fart simpson posted:An array is a collection of objects of the same type T, stored in contiguous memory. Arrays are created using brackets [], and their size, which is known at compile time, is part of their type signature [T; size]. yea, but you can interact with them via slices, which don't have a static length. the compiler is maintaining the real size of the array for safety reasons while still letting you access it in a more straightforward way in your type definitions. a parameter type that can accept both of your example arrays is just &[i32] (or &mut [i32] for a mutable slice) code:
|
# ? Aug 4, 2015 04:50 |
|
bobbilljim posted:it is truly scary how many people are against const / final http://www.infoq.com/presentations/Simple-Made-Easy Preferring mutability is a lot easier/more familiar to most people than the less complicated solution of preferring immutability there's also the extreme inertia of mainstream practices to prefer mutability I think it just takes time for these things to take hold a lot of people like to point out that it took a generation of programmers before arguments over using JMP as a regular control flow construct were finished
|
# ? Aug 4, 2015 05:42 |
|
Uncomfortable Gaze posted:yea, but you can interact with them via slices, which don't have a static length. the compiler is maintaining the real size of the array for safety reasons while still letting you access it in a more straightforward way in your type definitions. yeah
|
# ? Aug 4, 2015 06:43 |
|
rust has a thing called dynamically-sized types where references to a lot of similar-ish concrete types can turn into fat references to a more generic type and the extra info from the type that got lost in the conversion so &-references to [T; 1], [T; 42], [T; a million] can all be turned into &[T], which is basically a (ptr, length) tuple. this sorta makes intuitive sense to me since you can't have, like, a local variable of an array of a length that is only dynamically known, if it's not statically sized it has to live behind a pointer indirection. it actually also works like that for functions and closures, where even among functions with the same signatures, every one is its own type. so when you pass a function to another function that's generic over the function type, the other function gets a shot at inlining your function into it since it's monomorphized knowing the exact function type and hence the exact function. and when you need to do stuff where you don't know statically what function you're looking at, you forget the type and use an actual function pointer (or for closures a fat pointer like (fnptr, closed-over-data-ptr)) remember that rust needs to appeal to C++ nerds who've been telling themselves that abstractions should be zero-cost for decades, so they basically need to be able to pretend that a sufficiently smart compiler can see through all the abstractions and generate optimal code since all the type info is still there!! suffix posted:did delphi ever get usable generics? i remember looking at a program to figure out why it loaded files so slowly, and it had like six copies of bubble sort for different array types. yeah but the version we use doesn't. everything even slightly abstracted is either stringly-typed (TStringList as a list of "key=value" strings) or dynamically-typed (apparently there's Variant types which can be most of the types you'd find in an sql thing, and conveniently anything even slightly non-trivial we do seems to invole a lot of juggling sql-derived data). i wrote (copied from wikipedia) a quicksort the other day because there didn't seem to be a reasonable general sort function (not even something like qsort in C's stdlib), but got to throw it away when it turned out i could just dump all my data in a thing for representing sql query results and tell it to sort it instead.
|
# ? Aug 4, 2015 07:26 |
|
c terrible programmer s: finally got my c++ port of the deep dream technique working. was bashing my head against it for a while and then started a snack overflow post, halfway through the post i knew where to look to find the problem rubber duck debugging works yo
|
# ? Aug 4, 2015 19:16 |
|
my boss/professor is making our 16 year old intern use R, i have no experience with R but i assume this is a bad idea
|
# ? Aug 4, 2015 20:47 |
|
Dessert Rose posted:c terrible programmer s: finally got my c++ port of the deep dream technique working. rubber ducks are the best and stackoverflow is pretty great for inducing the rubber duck experience, because you just know if you don't spell out your problem precisely enough, some shitlord there is gonna try to get your question closed or w/e
|
# ? Aug 4, 2015 20:56 |
|
i opened a question on stack overflow sometime asking about a recursive permutation algorithm and it was just full of people going "i dont understand", "what does the swap function do?"
|
# ? Aug 4, 2015 21:02 |
|
Awia posted:my boss/professor is making our 16 year old intern use R, i have no experience with R but i assume this is a bad idea the one good thing I can say about R is that at least it isn't matlab
|
# ? Aug 4, 2015 21:02 |
Dessert Rose posted:snack overflow
|
|
# ? Aug 4, 2015 21:29 |
|
comedyblissoption posted:I think Rich Hickey made a cool talk about why this is so im sorry but mutability is key to getting maximum performance out of my perl scripts
|
# ? Aug 4, 2015 21:46 |
|
ConanTheLibrarian posted:im sorry but mutability is key to getting maximum performance out of my perl scripts i would like to recommend that you make use of this forum's mutable posts instead of allocating new ones all the time
|
# ? Aug 4, 2015 23:08 |
|
Soricidus posted:the one good thing I can say about R is that at least it isn't matlab i kinda like r
|
# ? Aug 5, 2015 01:26 |
|
R sure is a thing that exists
|
# ? Aug 5, 2015 04:15 |
|
Bloody posted:R sure is a thing that exists imo the best thing you can do for an intern is to make them work on terrible/legacy code. R might not be a bad choice.
|
# ? Aug 5, 2015 04:18 |
|
i loved this poo poo in middle school
|
# ? Aug 5, 2015 04:21 |
|
MALE SHOEGAZE posted:imo the best thing you can do for an intern is to make them work on terrible/legacy code. ugh no they ask so many questions. why are they so helpless and useless. why can't they just Google poo poo. gently caress
|
# ? Aug 5, 2015 04:24 |
|
fresh hires, too. asking so many dumb rear end questions. when I say I don't know what I'm really saying is just figure it out yourself, it's not complicated, put in some effort, stop bothering me
|
# ? Aug 5, 2015 04:25 |
|
Bloody posted:fresh hires, too. asking so many dumb rear end questions. when I say I don't know what I'm really saying is just figure it out yourself, it's not complicated, put in some effort, stop bothering me those people really piss me off
|
# ? Aug 5, 2015 06:32 |
|
Awia posted:my boss/professor is making our 16 year old intern use R, i have no experience with R but i assume this is a bad idea
|
# ? Aug 5, 2015 07:19 |
|
Bloody posted:fresh hires, too. asking so many dumb rear end questions. when I say I don't know what I'm really saying is just figure it out yourself, it's not complicated, put in some effort, stop bothering me I politely nod and reply, "I've got a link I can send you." Then I email them lmgtfy.com links.
|
# ? Aug 5, 2015 08:04 |
|
coffeetable posted:there is no good reason to use R over python for a new project i said that, but they've switched to python now anyway
|
# ? Aug 5, 2015 14:02 |
|
is it possible to sniff data off bluetooth connections without pairing? ive got like one of those fitness bands that i wanna get the stuff off without using the normal app alternatively could i just sit a sniffer near it during a normal pair and collect everything?
|
# ? Aug 5, 2015 14:07 |
|
yes*
|
# ? Aug 5, 2015 14:11 |
|
coffeetable posted:there is no good reason to use R over python for a new project except if there's r packages that do the analyses you need but you'd have to write the python yourself
|
# ? Aug 5, 2015 14:12 |
|
Bloody posted:fresh hires, too. asking so many dumb rear end questions. when I say I don't know what I'm really saying is just figure it out yourself, it's not complicated, put in some effort, stop bothering me actually the worst is when you give them the answer and tell them why its the answer and then they don't do it like you said because it would take them 10 extra minutes
|
# ? Aug 5, 2015 14:13 |
|
fritz posted:except if there's r packages that do the analyses you need but you'd have to write the python yourself also ggplot is reason enough to go with r
|
# ? Aug 5, 2015 14:13 |
|
r has easier to use plotting stuff built into it than matplotlib
|
# ? Aug 5, 2015 15:40 |
|
Bloody posted:yes* hit me with the footnote
|
# ? Aug 5, 2015 16:13 |
|
is this safe space accepting of indentation style discussions
|
# ? Aug 5, 2015 16:27 |
|
Bloody posted:fresh hires, too. asking so many dumb rear end questions. when I say I don't know what I'm really saying is just figure it out yourself, it's not complicated, put in some effort, stop bothering me i wish i had better mentoring, because they're all like this, because the definition of what is simple is relative i try not to do it as much, but if it's like "what does group by do in sql" i get annoyed
|
# ? Aug 5, 2015 16:30 |
|
Vanadium posted:is this safe space accepting of indentation style discussions no do what your team lead does if you dont have a spec make one and then make whatever bullshit decision you want because theyre all wrong
|
# ? Aug 5, 2015 16:30 |
|
|
# ? Jun 5, 2024 06:08 |
|
Vanadium posted:is this safe space accepting of indentation style discussions hard tabs or gtfo
|
# ? Aug 5, 2015 16:31 |