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.
 
  • Locked thread
echinopsis
Apr 13, 2004

by Fluffdaddy
cool

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

LeftistMuslimObama posted:

I've never been able to wrap my head around functional languages, but I'm also not a math guy so maybe some of the appeal is lost on me.

I tried to learn prolog briefly after the TA in our Compilers class made a big deal about how cool it was, but ultimately it seemed pretty useless for anything but making toy queries against small datasets. All his demos involved hard coding some statements to query against, and he really floundered if I asked if you could hook it up to a big SQL database or something. And if you've got a big SQL database, chances are you have a more mature platform for querying it than playing with it in prolog anyway.

tbh prolog is way more math-y than any of the fp malarkey

for me the value i got out of it was the processing model it uses for deduction, and how it handles ambiguity, and non determinism. those things come up every so often and having a good mental model feels good man

MononcQc
May 29, 2007

MALE SHOEGAZE posted:

I'm doing elixir and it feels too much like ruby for me to trust it very much

Can I interest you in some Erlang?

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

echinopsis posted:

epic as in ue4?

This comes up unironically so many times irl that I just say "I worth in healthcare IT" when people ask. Saves the sad look on their face when they find out I am not a cool video game person.

It's extra funny people we probably have 1000x the revenue that Epic Games has, and it's almost guaranteed you have at least some medical records on you in one of our customers' databases, but nobody's heard of us outside of the industry because we let our customers rebrand everything and market their Epic installation as whatever they want.

For example, University of Wisconsin calls it UW HealthConnect.


Thanks City of Glompton for the glorious sig

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
no one is ever allowed to complain about javascript ever again

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

MononcQc posted:

Can I interest you in some Erlang?

i already own your book dude geeze!

echinopsis
Apr 13, 2004

by Fluffdaddy

LeftistMuslimObama posted:

This comes up unironically so many times irl that I just say "I worth in healthcare IT" when people ask. Saves the sad look on their face when they find out I am not a cool video game person.

It's extra funny people we probably have 1000x the revenue that Epic Games has, and it's almost guaranteed you have at least some medical records on you in one of our customers' databases, but nobody's heard of us outside of the industry because we let our customers rebrand everything and market their Epic installation as whatever they want.

For example, University of Wisconsin calls it UW HealthConnect.

awesome. I mean I was hoping it was ue4 epic but it's not but medical is cool I sella the drugs and use computes to help records etc also not in the US OF A so yeah

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

echinopsis posted:

awesome. I mean I was hoping it was ue4 epic but it's not but medical is cool I sella the drugs and use computes to help records etc also not in the US OF A so yeah

The Cambridge NHS, the Danish national healthcare system, most of the Netherlands, and Saudi Aramco also use us. Are you in any of those? Oh, also a lot of canadian customers.

Also, if you're an adorable third world orphan, Aga Khan is converting to Epic.


Thanks City of Glompton for the glorious sig

Notorious b.s.d.
Jan 25, 2003

by Reene

LeftistMuslimObama posted:

Yeah, he posts in the Madison thread with the rest of us. It's possible Epic will eventually break my spirit, but considering that my high school days involved gang fights and an extensive sealed record and I've managed to claw my way up to 75k a year with a poetry composition degree to my name, I'm p happy with Epic atm.

don't brag about money in yospos because i guarantee you there are fuckers making 10x that and not having to cry in the bathroom between intersystems caché debugging sessions

Notorious b.s.d.
Jan 25, 2003

by Reene

LeftistMuslimObama posted:

I've never been able to wrap my head around functional languages, but I'm also not a math guy so maybe some of the appeal is lost on me.

you know what's fuckin awesome about functional programming? map and reduce

everything else is a bunch of fancy spooge sprayed on the screen by math nerds

(after you get used to turning everything into a sequence of map and reduce operations you end up writing "functional" code in every language anyway)

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
any language without map/reduce is unusable garbage

MeruFM
Jul 27, 2010
terrible programmer post

why is concatenating strings in rust like pulling out teeth through the nose?

Notorious b.s.d.
Jan 25, 2003

by Reene

MALE SHOEGAZE posted:

any language without map/reduce is unusable garbage

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Notorious b.s.d. posted:

you know what's fuckin awesome about functional programming? map and reduce

everything else is a bunch of fancy spooge sprayed on the screen by math nerds

(after you get used to turning everything into a sequence of map and reduce operations you end up writing "functional" code in every language anyway)

One of the TAs in my OSes class gave a lecture on map reduce, it sounded pretty cool for some types of problems. I haven't encountered a use case for it in my work though.

And sorry if I came off as bragging. I wasn't trying to. Just 6 years ago I was making minimum wage and living in my in-laws' basement so the statement was "I just feel so loving lucky to be making this much, I'm not really looking to upgrade jobs hastily". Like I said, I literally came from a place where I was stabbed in my actual body with a knife during a gang altercation. I might as well be Mitt Romney compared to what my life situation put me at any probability for.

I think what the world really needs is an APL to MUMPS transpiler.


Thanks City of Glompton for the glorious sig

MeruFM
Jul 27, 2010
map has a lot more obvious use cases than reduce just because everything about computers is about working with lots of similar data

having an array and doing the same thing to all the items in the array is the most basic program after helloworld

Notorious b.s.d.
Jan 25, 2003

by Reene

MeruFM posted:

terrible programmer post

why is concatenating strings in rust like pulling out teeth through the nose?

i have no loving clue. immutable strings are like, the EASIEST immutable thing. every language should have immutable strings by default.

rust, the language obsessed with mutability, takes the easiest god drat thing to make immutable and just barfs everywhere

Notorious b.s.d.
Jan 25, 2003

by Reene

LeftistMuslimObama posted:

And sorry if I came off as bragging. I wasn't trying to. Just 6 years ago I was making minimum wage and living in my in-laws' basement so the statement was "I just feel so loving lucky to be making this much, I'm not really looking to upgrade jobs hastily". Like I said, I literally came from a place where I was stabbed in my actual body with a knife during a gang altercation. I might as well be Mitt Romney compared to what my life situation put me at any probability for.

yeah a lot of us know the feeling

but mentioning a number is dangerous, the TOPPERS LURK IN THE NIGHT

MononcQc
May 29, 2007

MeruFM posted:

map has a lot more obvious use cases than reduce just because everything about computers is about working with lots of similar data

having an array and doing the same thing to all the items in the array is the most basic program after helloworld

Technically, a reduce step (or a fold) is universal (any iteration over a data set can be implemented through a fold/reduce) and you can implement map with it. The opposite isn't true.

Bloody
Mar 3, 2013

how are map and reduce spelled in linq

I really like linq and I think it means I'm a functional programmer now

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Bloody posted:

how are map and reduce spelled in linq

I really like linq and I think it means I'm a functional programmer now

I am extremely dysfunctional.

echinopsis
Apr 13, 2004

by Fluffdaddy

MALE SHOEGAZE posted:

any language without map/reduce is unusable garbage

mlyp

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Bloody posted:

how are map and reduce spelled in linq

I really like linq and I think it means I'm a functional programmer now

i dont use c# but from reading yosposts i think map is called select in linq and reduce/fold is called aggregate

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

LeftistMuslimObama posted:

I think what the world really needs is an APL to MUMPS transpiler.

functional reactive mumps

frumps

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

eschaton posted:

functional reactive mumps

frumps

i was thinking that as a lark i would make Java and C# libraries that added M global style data structures and syntax. I would call them JUMPS and CHUMPS.

And, hilariously, my implementation would probably be faster because MUMPS globals are stored as flat ASCII files with special delimiter characters delimiting the globals and then subscripts within the globals. You literally can't retrieve data from a MUMPS global faster than O(log n). On the plus side O(n log n) is the worst-case performance. Usually disk will be the actual bottleneck, but I bet I could implement them as a hash map or something behind the scenes using the $na of each subscript as the key or something.

And this is, well and truly, the most frustrating thing about mumps. The lack of an O(1) lookup time for anything. There's no way to just get a normal array. This means that anywhere you'd want a hash table (I really wanted want to do duplicate-checking for a compiler I was writing), you don't get true hashtable performance. After profiling, it was provably faster to just do duplicate compiles of the objects I was compiling than to check for duplicates :(

VikingofRock
Aug 24, 2008




MeruFM posted:

terrible programmer post

why is concatenating strings in rust like pulling out teeth through the nose?

What specifically is hard about it? It doesn't seem that bad to me:

code:
fn main(){

    //Concatenation
    let first: String = "Hello".into();
    let second: String = " World".into();
    println!("{}", first + &second);

    //Extension
    let mut terrible: String = "yos".into();
    let programmers: String = "pos".into();
    terrible.push_str(&programmers);
    println!("{}", terrible);

    //Mass concatenation
    let many_strings = ["one", "two", "three"];
    println!("{}", many_strings.join(", "));
}
(playground)

join() in particular seems to take care of a lot of the more annoying cases fairly well.

MeruFM
Jul 27, 2010

VikingofRock posted:

code:
fn main(){
    let first: String = "Hello".into();
    let second: String = " World".into();
    println!("{}", first + &second);
}

you don't think this is a problem?

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

LeftistMuslimObama posted:

for a compiler I was writing

OK, you just need to repeat this phrase to yourself any time you're feeling the imposter syndrome

and that's before considering the fact that you're talking about writing a compiler in MUMPS

you might just not be an imposter

or junior

Notorious b.s.d.
Jan 25, 2003

by Reene

VikingofRock posted:

What specifically is hard about it? It doesn't seem that bad to me:

code:
fn main(){

    //Concatenation
    let first: String = "Hello".into();
    let second: String = " World".into();
    println!("{}", first + &second);

    //Extension
    let mut terrible: String = "yos".into();
    let programmers: String = "pos".into();
    terrible.push_str(&programmers);
    println!("{}", terrible);

    //Mass concatenation
    let many_strings = ["one", "two", "three"];
    println!("{}", many_strings.join(", "));
}
(playground)

join() in particular seems to take care of a lot of the more annoying cases fairly well.

why the gently caress do all of these have to be mutable

VikingofRock
Aug 24, 2008




MeruFM posted:

you don't think this is a problem?

Not really. Is it the .into()s that are annoying to you? I could see it being kind of annoying that Add isn't defined for &strs, but I think it makes sense because of the way the Add trait is defined. Also only the first string really needs to be a String, I could have just left the second one as an &str instead of casting it back and forth.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

VikingofRock posted:

What specifically is hard about it? It doesn't seem that bad to me:

code:

fn main(){

    //Concatenation
    let first: String = "Hello".into();
    let second: String = " World".into();
    println!("{}", first + &second);

    //Extension
    let mut terrible: String = "yos".into();
    let programmers: String = "pos".into();
    terrible.push_str(&programmers);
    println!("{}", terrible);

    //Mass concatenation
    let many_strings = ["one", "two", "three"];
    println!("{}", many_strings.join(", "));
}
(playground)

join() in particular seems to take care of a lot of the more annoying cases fairly well.

that looks p gross to me

and I'm the kind of person who thinks Objective-C is generally right in the way it tends towards verbosity

seriously, the above looks better in ObjC

code:

int main(int argc, char **argv) {
  @autoreleasepool {
    // Concatenation
    NSString *first = @"Hello";
    NSString *second = @" World";
    NSLog(@"%@", [first stringByAppendingString:second];
    
    // Extension
    NSMutableString *terrible = [@"yos" mutableCopy];
    NSString *programmers = @"pos";
    [terrible appendString:programmers];
    NSLog(@"%@", terrible);

    // Mass concatenation
    NSArray <NSString *> *manyStrings = @[@"one", @"two", @"three"];
    NSLog(@"%@", [manyStrings componentsJoinedByString:@", "]);
  }
  return 0;
}

VikingofRock
Aug 24, 2008




Notorious b.s.d. posted:

why the gently caress do all of these have to be mutable

Assuming by mutable you mean the fact that they are Strings instead of &strs:

The first one: because of the way Add is defined.
The second one: has to be mutable because I am mutating it.
The third one: These are &strs, and only the result is a String (which makes sense for the same reason you can't concatenate c string literals).

VikingofRock
Aug 24, 2008




I agree that it would be nice to have a short hand for creating a String from a literal. But I think the actual concatenation is fine.

edit: Also it's a little dumb in this case that Add consumes its first argument. But I can understand why they made that choice in general.

VikingofRock fucked around with this message at 06:49 on Oct 16, 2015

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Notorious b.s.d. posted:

why the gently caress do all of these have to be mutable

they aren't all mutable though? what do you mean

Notorious b.s.d.
Jan 25, 2003

by Reene

VikingofRock posted:

edit: Also it's a little dumb in this case that Add consumes its first argument. But I can understand why they made that choice in general.

i really truly do not understand why they made that choice, please explain

MeruFM
Jul 27, 2010

VikingofRock posted:

Not really. Is it the .into()s that are annoying to you? I could see it being kind of annoying that Add isn't defined for &strs, but I think it makes sense because of the way the Add trait is defined. Also only the first string really needs to be a String, I could have just left the second one as an &str instead of casting it back and forth.

requiring a concat to have different types on each side just creates a load of headaches on anything that relies on other modules.



I get it now. I feel dumb because it was said in the 1st line of the rust webpage.

quote:

Rust is a systems programming language

this language is safe c, not strict python

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i'd probably write that rust strings thing like this fwiw (nothing)

code:
fn main(){
    //Concatenation
    let first = "Hello".to_string();
    let second = " World";
    println!("{}", first + second);
    //Extension
    let mut terrible = "yos".to_string();
    let programmers = "pos";
    terrible.push_str(programmers);
    println!("{}", terrible);
    //Mass concatenation
    let many_strings = ["one", "two", "three"];
    println!("{}", many_strings.join(", "));
}

MeruFM
Jul 27, 2010
i mean it's silly and already obviously bad in the simplest case but I tried to add in a function that returns a "&&*string?", spent 5 minutes and 10 or so compiles before getting it to work, and then promptly rm'd the project folder.

that's my bad programmer story

VikingofRock
Aug 24, 2008




Notorious b.s.d. posted:

i really truly do not understand why they made that choice, please explain

It's because Add is defined as a method on an object, so it has to do something with that object (either consume it or borrow it). It's not really safe to assume that everything you might define Add for should not be consumed by the operation, so they chose to consume the caller. For most things that you add (like most numeric types) this doesn't matter because they are Copy anyways, so they don't get consumed. But strings are not Copy so they do get consumed. You could also make the argument that for Strings this is the more conservative choice, because it avoids unnecessary copying of the first string if you weren't going to use it again. And if you were going to use it again, you can just copy it yourself or use a function like join() which does so behind the scenes.

Honestly though I'm not sure that they should have defined Add for Strings at all. Instead they should have defined a Concat trait, maybe with a concat operator if they were feeling really fancy (like Haskell's ++ operator). String addition doesn't really obey the same semantics as numeric addition so it's always seemed like it should be a separate operator to me. But lots of languages define the + operator for strings so I can't hold it against Rust too much.

edit:

MeruFM posted:

this language is safe c, not strict python
also this

VikingofRock fucked around with this message at 07:29 on Oct 16, 2015

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

they should have defined a Monoid trait and named the operator `mappend`

Adbot
ADBOT LOVES YOU

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

or called it <> like it is in haskell

  • Locked thread