|
when comparing data structures you should consider the implementation as well as the interface. sure, an array basically looks like a map where the index is the key. but the expected implementation of something called "array" in C-derived languages is "a contiguous area of memory so that indexing is just a pointer offset". this kind of guaranteed constant time access is important for many algorithms, where you can't just fake it with a hash of ints and hope the amortization works out
|
# ? Jul 18, 2017 05:57 |
|
|
# ? Jun 11, 2024 11:06 |
|
sarehu posted:When your keys are, like, non-sparse numbers? gently caress off shrughes
|
# ? Jul 18, 2017 06:59 |
|
sarehu posted:When your keys are, like, non-sparse numbers? is this a real post
|
# ? Jul 18, 2017 12:07 |
|
is this just fantasy?
|
# ? Jul 18, 2017 12:24 |
|
caught in a LAN slide
|
# ? Jul 18, 2017 13:17 |
|
no escape from banality
|
# ? Jul 18, 2017 13:28 |
|
open your IDEs
|
# ? Jul 18, 2017 14:13 |
|
look up the standards for C
|
# ? Jul 18, 2017 15:00 |
|
im just a plang boy
|
# ? Jul 18, 2017 16:21 |
|
eventual consistency
|
# ? Jul 18, 2017 17:04 |
|
my bugs are easy come, easy go
|
# ? Jul 18, 2017 17:05 |
|
round it high, round it low
|
# ? Jul 18, 2017 17:08 |
|
macos or windows, doesn't really matter to me
|
# ? Jul 18, 2017 17:14 |
|
cinci zoo sniper posted:im not surprised, if he is anything his programs are then we have radically different opinions on things i've drifted from anti- to neutral on the hadleyverse. it's very elegant for a subset of workflows that happen to make up a big chunk of day to day analysis, but even if you master the DSL you're still stuck with the language as a whole.
|
# ? Jul 18, 2017 17:14 |
|
god dammit motedek.
|
# ? Jul 18, 2017 17:15 |
|
i sometimes wish id never been bourne at all
|
# ? Jul 18, 2017 17:26 |
motedek posted:i've drifted from anti- to neutral on the hadleyverse. it's very elegant for a subset of workflows that happen to make up a big chunk of day to day analysis, but even if you master the DSL you're still stuck with the language as a whole. generally speaking im neutral about the hadleyverse, but mainly because im too lame to have strong coding opinions. thatd be like me waltzing in now with a tirade about shortcommings of punctuation in mongolian or something. nonetheless, its opinionated af, and that i dont really like. ill take any amount of suggestion every day of the week, but not enforcing them in obtuse ways, or making backwardish implementations of your opinions in packages. for how much i heard about ggplot or studio, im fairly disappointed in both. r itself is a whole another bag of something, but i havent made it far into advanced r stuff, and my new job researcha and learning phase is coming to an end, so i probably wont get until oop and poo poo for a while. hopefuly if ever, since ive heard that one of my coworkers had to write a custom faux-multithreaded implementation of certain popular algorithms for a typical-ish job task. going to try to squeeze a different lang if a time for that comes at some point, even python.
|
|
# ? Jul 18, 2017 17:28 |
|
MALE SHOEGAZE posted:i sometimes wish id never been bourne at all Now this one needs no editing to apply to programming
|
# ? Jul 18, 2017 17:29 |
Mama Just killed program Memory usage in the red Had to C-C now it's dead
|
|
# ? Jul 18, 2017 18:57 |
code:
|
|
# ? Jul 18, 2017 18:59 |
|
Parent spaghetti
|
# ? Jul 18, 2017 19:03 |
VikingofRock posted:Nothing really matters
|
|
# ? Jul 18, 2017 20:54 |
|
sarehu posted:When your keys are, like, non-sparse numbers? then you want dictionary semantics, and as an optimization store the values in a contiguous array with implied keys
|
# ? Jul 18, 2017 21:21 |
|
Actually you don't want a simple array or vector because it's expensive to grow, come to think of it... but anyway, an array is just a dictionary with mandatory relationships between valid key values combined with algebraic structure. For example, you can make a dictionary whose keys are bit strings with the restriction that every prefix of a bit string is an element of the dictionary, and have append operations where one dictionary's strings get prefixed by an element of the other. So yeah, arrays are just a kind of dictionary.
|
# ? Jul 18, 2017 21:37 |
|
sarehu posted:For example, you can make a dictionary whose keys are bit strings with the restriction that every prefix of a bit string is an element of the dictionary, and have append operations where one dictionary's strings get prefixed by an element of the other. what why
|
# ? Jul 18, 2017 22:51 |
|
sarehu posted:Actually you don't want a simple array or vector because it's expensive to grow, come to think of it... but anyway, an array is just a dictionary with mandatory relationships between valid key values combined with algebraic structure. For example, you can make a dictionary whose keys are bit strings with the restriction that every prefix of a bit string is an element of the dictionary, and have append operations where one dictionary's strings get prefixed by an element of the other. So yeah, arrays are just a kind of dictionary. stop triggering me
|
# ? Jul 18, 2017 23:01 |
|
sarehu posted:Actually you don't want a simple array or vector because it's expensive to grow, come to think of it... but anyway, an array is just a dictionary with mandatory relationships between valid key values combined with algebraic structure. For example, you can make a dictionary whose keys are bit strings with the restriction that every prefix of a bit string is an element of the dictionary, and have append operations where one dictionary's strings get prefixed by an element of the other. So yeah, arrays are just a kind of dictionary. in other news hurrrr
|
# ? Jul 19, 2017 01:06 |
|
i like bignums and i cannot lie
|
# ? Jul 19, 2017 02:23 |
|
arrays are after all just a special case of bignums
|
# ? Jul 19, 2017 11:32 |
|
u (stupid): arrays are dictionaries me (smart): both dictionaries and arrays are a special case of the digits of pi, if u really think about it Mr SuperAwesome fucked around with this message at 12:20 on Jul 19, 2017 |
# ? Jul 19, 2017 11:35 |
Mr SuperAwesome posted:u (stupid): arrays are dictionaries arrays are sometimes multidimensional strings
|
|
# ? Jul 19, 2017 12:14 |
|
VikingofRock posted:But don't most interpreted / dynamic languages carry around type information at runtime? I know python does, and I'm pretty sure most flavors of lisp do, too. Yeah good point. I think the more important issue is probably applying the type checks themselves at runtime. The more complex your type system is, the more costly this becomes.
|
# ? Jul 19, 2017 13:43 |
|
I had this really funny notion in my head that an array is a data structure and a dictionary is a data type
|
# ? Jul 19, 2017 17:16 |
|
there are a lot of languages which call their basic sequence data type an array because arrays are the obviously superior implementation mechanism for sequences unless your language pushes you super hard towards functional-style head/tail construction and decomposition
|
# ? Jul 19, 2017 18:22 |
MALE SHOEGAZE posted:Yeah good point. I think the more important issue is probably applying the type checks themselves at runtime. The more complex your type system is, the more costly this becomes. Yeah but I think most dynamic languages also perform type checks at runtime. For example, in both Python 2 and 3 "11" + 1 throws a runtime error, and I'm pretty sure in most lisps (+ "11" 1) is an error as well. So it's gotta be something else.
|
|
# ? Jul 19, 2017 19:10 |
|
reminder that "11" + 1 is valid in java, which completely statically and predictably converts the int to a string and gets on with doing the obvious correct thing the problem is languages that think the result should be 12, or (god forbid) "12"
|
# ? Jul 19, 2017 19:18 |
|
all of these decisions are purely arbitrary automated type casting and conversions and it doesn't matter if it's done at runtime or at compile time, you just gotta learn them. Like I don't doubt you could have a language or compiler with enough type information at some point to make the decision JS makes, but at compile time. You just gotta go and "well if this is + operator is called with an integer and a string, instead delegate to this method/function instead." There you're done. The compiler knows about the dispatch rules, the branching is not done at run-time, and it is still idiotic. It just happens that for most of the time, dynamic languages are the ones that do it, but there is nothing asking for this to happen. The behaviour is separate from when the type checking takes place.
|
# ? Jul 19, 2017 20:07 |
|
"Doctor, doctor, it hurts when I do this!" "Then don't do that."
|
# ? Jul 19, 2017 20:43 |
|
concatenation and addition shouldn't use the same operator, at least not in the presence of any coercion
|
# ? Jul 19, 2017 21:02 |
|
|
# ? Jun 11, 2024 11:06 |
|
As long as you can dispatch implementations based on type signatures, nothing keeps you from doing something like +(Float, Float) => Float +(Float, Int) => Float +(Int, Float) => Float +(Int, Int) => Int +(String, Int) => String +(String, String) => String +(Int, String) => Int +(Int, Bool) => Float +(Bool, Bool) => String Like all these variations of the operators could be dispatched and tolerated fine by any compiler out there. They don't have to make sense, you just have to be able to analyze types at compile time and dispatch.
|
# ? Jul 19, 2017 21:22 |