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
VikingofRock
Aug 24, 2008




Rust cannot get HKTs soon enough IMO. Mon(oi|a)ds for life!

Adbot
ADBOT LOVES YOU

VikingofRock
Aug 24, 2008




BTW if someone figures out which language is strict Python, they should let me know.

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

you dont need hkts for monoids though. i'm pretty sure you could define that trait right now

code:
trait Monoid {
    fn empty(&self) -> Self;
    fn append(&self, other: Self) -> Self;
}

impl Monoid for String {
    fn empty(&self) -> String {
        "".to_string()
    }
    
    fn append(&self, other: String) -> String {
        let new = self.clone();
        new + &other
    }
}

fn main(){
    //Concatenation
    let first: String = "Hello".to_string();
    let second: String = " World".to_string();
    println!("{}", first.append(second).append("!".to_string()));
}

Shaggar
Apr 26, 2006

fart simpson posted:

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

select/aggregate makes a million times more sense then map/reduce. god drat math majors are retards

Bloody
Mar 3, 2013

i dont think i have ever used aggregate

Shaggar
Apr 26, 2006
mostly I've just used it for combining strings and things

gonadic io
Feb 16, 2011

>>=

Shaggar posted:

select/aggregate makes a million times more sense then map/reduce. god drat math majors are retards
select sounds like it should be a find operation

triple sulk
Sep 17, 2014



gonadic io posted:

select sounds like it should be a find operation

Stringent
Dec 22, 2004


image text goes here
apply/aggregate maybe?

Shaggar
Apr 26, 2006

gonadic io posted:

select sounds like it should be a find operation

where is the find operation. select is just selecting from the set.

Bloody
Mar 3, 2013

select is just sql

Shaggar
Apr 26, 2006
ya sql is really good

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

gonadic io posted:

select sounds like it should be a find operation

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Bloody posted:

i dont think i have ever used aggregate

if you've ever used sum on an array of numbers then you've basically used a version of it with the + operator hardcoded in as the aggregator function. if you really wanted to you could implement most of the other things with just that.

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Shaggar posted:

where is the find operation. select is just selecting from the set.

actually i think where is a filter operation? anyway it sounds like they'd go together, like select the items where x > 5 or something. and what do you mean by selecting from the set? select is applying a function to each item of the set, isnt it?

Shaggar
Apr 26, 2006
yes its a function, but the function can be just selecting the value of the item or a property of the item

Shaggar
Apr 26, 2006
the set in this case is whatever IEnumerable you're working on or the result of a previous linq operation

lord of the files
Sep 4, 2012

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

Map =
Reduce = Aggregate
Filter = Where

these only exist from LINQ 3.5 and above. the obvious caveat here is that this will run in memory and wont be distributed. even without the scaling that google can provide, it’s still useful to think of problems in a map/reduce mindset.

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?
that ray tracer written in linq was pretty cool

ed: http://blogs.msdn.com/b/lukeh/archive/2007/10/01/taking-linq-to-objects-to-extremes-a-fully-linqified-raytracer.aspx

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

gonadic io posted:

select sounds like it should be a find operation

in mumps select is a ghetto switch statement:

s result = $s(post'="":"shitpost", post="":"doubleshitpost",1:"tripleshitpost").

since there's no such thing as a proper switch statement, usually you see the result strings as code to execute and the next line is an x or d @ statement on the result variable.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

there's a cobol cgi-bin compiler out there don't forget

jony neuemonic
Nov 13, 2009


holy moly.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

i understand approximately 0% of this.

gonadic io
Feb 16, 2011

>>=

gonadic io
Feb 16, 2011

>>=

LeftistMuslimObama posted:

i understand approximately 0% of this.

C# let expressions aren't recursive, and in linq everything is declared with let so they use a lambda-theory trick to implement recursion themselves.

That's all you need to know (the rest is just standard linear algebra of lines and points and planes etc)

Bloody
Mar 3, 2013

fart simpson posted:

if you've ever used sum on an array of numbers then you've basically used a version of it with the + operator hardcoded in as the aggregator function. if you really wanted to you could implement most of the other things with just that.

yeah i know what it's for it just somehow hasn't seemed to come up in anything i do which is itself kind of odd

gonadic io
Feb 16, 2011

>>=
Also all/any on lists of bools is another common use in the standard library

Jerry Bindle
May 16, 2003
we started using confluence, its pretty cool! except its apparently a lot of work for the confluence janitor to setup new spaces, so our whole division is using one space, and we have to suffix a project serial number to every page we create so page titles don't conflict. and we don't have permission to delete pages, so we have a "Garbage Page" that you move pages to, and once a week the confluence janitor comes by and empties the garbage can.

Bloody
Mar 3, 2013

Barnyard Protein posted:

we started using confluence, its pretty cool! except its apparently a lot of work for the confluence janitor to setup new spaces, so our whole division is using one space, and we have to suffix a project serial number to every page we create so page titles don't conflict. and we don't have permission to delete pages, so we have a "Garbage Page" that you move pages to, and once a week the confluence janitor comes by and empties the garbage can.

lmao

Bloody
Mar 3, 2013

i have a git question

i have two git repositories, firmware and software. the software runs on a pc and interacts with the firmware which runs on an embedded platform. i want to merge these into one common repository and i would like to do so in a manner that preserves their histories and branches

is this a doable thing

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

gonadic io posted:

C# let expressions aren't recursive, and in linq everything is declared with let so they use a lambda-theory trick to implement recursion themselves.

That's all you need to know (the rest is just standard linear algebra of lines and points and planes etc)

I don't know anything about graphics (or linear algebra), so it's total magick to me. The most advanced math class I've taken was Calc I like 9 years ago in college.

We're allowed to spend some of our time each week on learning though. Any good tutorials or books I could read to catch myself up on this stuff? Or should I not feel bad that I don't know anything about this topic?

Shaggar
Apr 26, 2006

Bloody posted:

i have a git question

i have two git repositories, firmware and software. the software runs on a pc and interacts with the firmware which runs on an embedded platform. i want to merge these into one common repository and i would like to do so in a manner that preserves their histories and branches

is this a doable thing

check everything out. delete the git stuff. combine them into a single folder. commit them to a subversion repo

Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today

Bloody posted:

i have a git question

i have two git repositories, firmware and software. the software runs on a pc and interacts with the firmware which runs on an embedded platform. i want to merge these into one common repository and i would like to do so in a manner that preserves their histories and branches

is this a doable thing
Yes, in fact it's pretty straightforward. You can fetch the other repository into a local branch and then merge that branch, or use a subtree merge.

Alternatively, you could make one a submodule of the other, but this is pretty pointless if you don't have multiple other repositories using it and want to keep developing it independently as well.

gonadic io
Feb 16, 2011

>>=

LeftistMuslimObama posted:

I don't know anything about graphics (or linear algebra), so it's total magick to me. The most advanced math class I've taken was Calc I like 9 years ago in college.

We're allowed to spend some of our time each week on learning though. Any good tutorials or books I could read to catch myself up on this stuff? Or should I not feel bad that I don't know anything about this topic?

Well you shouldn't feel bad, as it's pretty niche and if you're not working with some kind of 3D space (whether in a game or in real life) I can't imagine it coming up really.

I'm on my phone so can't fetch it, but coffeetable has a standard list of linear algebra book recommendations that he's posted a few times if you are interested.

gonadic io
Feb 16, 2011

>>=

Shaggar posted:

check everything out. delete the git stuff. combine them into a single folder. commit them to a subversion repo

Lol never change

Bloody
Mar 3, 2013

engineering mathematics by stroud

Valeyard
Mar 30, 2012


Grimey Drawer
Im on train back to Glasgow. I regret not getting lunch with the London crew but i loving hated it there

Elder Postsman
Aug 30, 2000


i used hot bot to search for "teens"

Bloody posted:

engineering mathematics by stroud

dang it's like fifty earth dollars

lord of the files
Sep 4, 2012

what do you call a parrot that says "squawk! pieces of nine! pieces of nine!"?

aparrot-ey error.

as for a translated, tl;dr: of that linq article:

linq is very dependent on lambdas. say you have a category with unlimited children with each child also having unlimited children. if you wanted to retrieve all of the children of the root node, there is no easy way to do that efficiently or intuitively. linq does not support the recursion needed to select all family nodes from a root node. however, if you use the "let" and "y combinator" fixed-point combinators, you can do it in a non-efficient manner. the article is using a cheating way to implement a recursive lambda.

Adbot
ADBOT LOVES YOU

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

gonadic io posted:

C# let expressions aren't recursive, and in linq everything is declared with let so they use a lambda-theory trick to implement recursion themselves.

didn't read the code but... this doesn't sound nice at all

  • Locked thread