Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
JewKiller 3000
Nov 28, 2006

by Lowtax
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

Adbot
ADBOT LOVES YOU

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

sarehu posted:

When your keys are, like, non-sparse numbers?

An example would be an array holding info about every block in a database file.

gently caress off shrughes

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

sarehu posted:

When your keys are, like, non-sparse numbers?

An example would be an array holding info about every block in a database file.

is this a real post

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
is this just fantasy?

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

caught in a LAN slide

AWWNAW
Dec 30, 2008

no escape from banality

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
open your IDEs

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
look up the standards for C

necrotic
Aug 2, 2005
I owe my brother big time for this!
im just a plang boy

AWWNAW
Dec 30, 2008

eventual consistency

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
my bugs are easy come, easy go

gonadic io
Feb 16, 2011

>>=
round it high, round it low

JewKiller 3000
Nov 28, 2006

by Lowtax
macos or windows, doesn't really matter to me

motedek
Oct 9, 2012

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.

JewKiller 3000
Nov 28, 2006

by Lowtax
god dammit motedek.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i sometimes wish id never been bourne at all

cinci zoo sniper
Mar 15, 2013




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.

gonadic io
Feb 16, 2011

>>=

MALE SHOEGAZE posted:

i sometimes wish id never been bourne at all

Now this one needs no editing to apply to programming

VikingofRock
Aug 24, 2008




Mama
Just killed program
Memory usage in the red
Had to C-C now it's dead

cinci zoo sniper
Mar 15, 2013




code:
look()
if (self.count("shot") == 1) or (self.count("opportunity") == 1):
    seize(lambda x: x.start(), wanted)

    try: 
        moment.capture()
    except:
        moment.let_slip()

self.palms.sweaty = True
self.knees.weak = True
self.sweater.append("vomit") 
self.arms.heavy = True
spaghetti.owner = self.parent  
self.nervous = True
#TODO:
# set a public property to calm and ready
# to drop bombs
while True:
    del writtenRhymes   

my new dog
May 7, 2007

by Nyc_Tattoo
Parent spaghetti

VikingofRock
Aug 24, 2008




VikingofRock posted:

Nothing really matters
Expressive ADTs
Nothing really matters
Nothing really matters
Nothing really matters
To meeee~~~

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

sarehu posted:

When your keys are, like, non-sparse numbers?

An example would be an array holding info about every block in a database file.

then you want dictionary semantics, and as an optimization store the values in a contiguous array with implied keys

sarehu
Apr 20, 2007

(call/cc call/cc)
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.

AWWNAW
Dec 30, 2008

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

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

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

MeruFM
Jul 27, 2010

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

Sapozhnik
Jan 2, 2005

Nap Ghost
i like bignums and i cannot lie

Cybernetic Vermin
Apr 18, 2005

arrays are after all just a special case of bignums

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
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

cinci zoo sniper
Mar 15, 2013




Mr SuperAwesome posted:

u (stupid): arrays are dictionaries
me (smart): both and arrays are a special case of the digits of pi, if u really think about it

arrays are sometimes multidimensional strings

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

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.

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
I had this really funny notion in my head that an array is a data structure and a dictionary is a data type

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
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

VikingofRock
Aug 24, 2008




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.

Soricidus
Oct 21, 2010
freedom-hating statist shill
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"

MononcQc
May 29, 2007

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.

Doom Mathematic
Sep 2, 2008
"Doctor, doctor, it hurts when I do this!"

"Then don't do that."

Dylan16807
May 12, 2010
concatenation and addition shouldn't use the same operator, at least not in the presence of any coercion

Adbot
ADBOT LOVES YOU

MononcQc
May 29, 2007

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.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply