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
Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



MrMoo posted:

Yup, with Google fonts you can just use their hosting and everything is hidden behind code they provide.

sure if you want to make it easier for goog to spy on your users

Adbot
ADBOT LOVES YOU

Kazinsal
Dec 13, 2011



Carthag Tuek posted:

sure if you want to make it easier for goog to spy on your users

in 2022 you are already completely pwned by faang and there's no turning back

git apologist
Jun 4, 2003

lambda just means anonymous function (function with no name), it’s inline in code instead of defined as part of your class or in the global namespace

it’s confusing for lots of reasons, also because of aws serverless functions being called lambda too

gonadic io
Feb 16, 2011

>>=

Gentle Autist posted:

lambda just means anonymous function (function with no name), it’s inline in code instead of defined as part of your class or in the global namespace

it’s confusing for lots of reasons, also because of aws serverless functions being called lambda too

they're named after the anonymous functions though so if lambda functions were called something else, the serverless functions owuld likely also be named that too

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
some typesetter didnt wanna do separate x hat dealios and now echi gets to be confused all the time

echinopsis
Apr 13, 2004

by Fluffdaddy
not that I wasn’t before

gonadic io
Feb 16, 2011

>>=
just think, we could have been living in a world with hat functions and aws hat services

akadajet
Sep 14, 2003

fedora functions

mystes
May 31, 2006

Amazon Top Hat brought to you by Jeff Bezos

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
lambda calculus is actually amazingly cool and if you care about cs theory at all you should try learning it. and it's not very hard to learn, because you can think of it as a simple programming language with only three language features: variables, function definitions, and function applications (aka calls). that's it. nobody would actually program in this language, but it serves as a theoretical foundation, because it turns out those three features are all you need for expressive power equivalent to a turing machine. you can come up with formal definitions of everything else you'd normally have (numbers and arithmetic, pairs, lists, etc) in terms of the lambda calculus, look up church encoding. and then you have other formal systems that are ultimately extensions of the lambda calculus and are actually used in modern research papers, so it's good to know if you ever want to read those. but even if not it's neat stuff.

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
the term "lambda" being used for anonymous function (or even by extension to a function in general, as in aws) is the bs cs top 50 nerd's absolute favorite kind of term: gatekeeping jargon whose use is unimpeachable due to association with core theory and the legendary church-turing of yore

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


DELETE CASCADE posted:

the term "lambda" being used for anonymous function (or even by extension to a function in general, as in aws) is the bs cs top 50 nerd's absolute favorite kind of term: gatekeeping jargon whose use is unimpeachable due to association with core theory and the legendary church-turing of yore

actually my insufferable trait is throwing the term cyclomatic complexity around because the whitespace from the nesting bothers me

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
oh well excuse everyone for not learning your stack's special snowflake terminology for everything, as if it was invented there

Presto
Nov 22, 2002

Keep calm and Harry on.

akadajet posted:

fedora functions

M'lambda

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
also the name "anonymous function" is a bit weird, like why does it matter so much that the function doesn't have a name? the reason is because this is novel to C programmers. in ansi C a function is a special kind of thing, and the only way you can create one is by defining it by name at the top level of a source file. unlike a first-class value such as an int, you can't pass a function to another function, nor can you return a function as a result. in C you can pass/return pointers to functions, because in C you can get a pointer to anything, but these "function pointers" are technically a special kind of pointer that can't even be cast to void*. any function pointer variable you manage to obtain will ultimately refer to a function that was defined by name at the top level of a source file

ok well, who the gently caress cares, right? a lot of examples you'll see in articles are like, hey i'm gonna pass this anonymous incrementer function to another function, so i write List.map (lambda x -> x + 1) lst and it increments every value of lst, magic! but i could have defined the lambda instead as incr, then passed a pointer to incr, how is this any better than C? the key is really in the italicized part above. what if, inside the definition of a function, i could create another (anonymous) function, and then return that new function as a result to be used outside my containing function's lexical scope, which is now ending because we are returning? and keep in mind, this new function can refer in its own definition to values that were available in the containing function's scope. it turns out that you can build truly massive edifices upon this house of cards

but we are still in C brain, so how does this poo poo work? when my containing (outer) function returns, its stack frame goes away, and with it the values in memory that the inner function may have referred to. what's the inner function supposed to do, magically malloc() copies of those variables on the heap for itself to remember them? then who's responsible for calling free() on them? this concept of a first-class (passable, returnable) function that remembers the values of free variables at the time it was defined is called a closure. the manual memory management style of C essentially precludes closures, and conversely most languages that support closures will have some variety of automatic garbage collection

oh wait this post was supposed to have a point. so after all, what's important about the anonymous function concept specifically? well if you are defining your inner function/closure inside an outer function, to be returned to a caller of the outer function, then i suppose you could give the inner function a name, but that name would disappear along with the scope of the outer function just like any other variable, so nobody else could ever use the name. basically, the presence of anonymous functions suggests that a closure-based style of programming is supported, because they're natural with it but useless without it

DELETE CASCADE fucked around with this message at 06:18 on Jun 13, 2022

sb hermit
Dec 13, 2016





A function that takes one function and returns another function is generally called a decorator

sb hermit
Dec 13, 2016





Presto posted:

M'lambda

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
yeah decorators are a great example and they even have a special python syntax for them. then again python closures are busted rear end bullshit because of late binding but that's a topic for anothuhhhhhhhhhhhhhhhhhh

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

Gazpacho posted:

oh well excuse everyone for not learning your stack's special snowflake terminology for everything
this could be a fun game of "guess the programmer"

they used "isomorphic"? must be nodejs
they used "delightful"? must be ruby
they used "kill me"? C

CPColin
Sep 9, 2003

Big ol' smile.
I've been through the lambda on a func with no name

Xarn
Jun 26, 2015

sb hermit posted:

A function that takes one function and returns another function is generally called a decorator

Hello Python guy.

outhole surfer
Mar 18, 2003

Xarn posted:

Hello Python guy.

rite?

i always just referred to them as higher order functions outside of python, though i guess decorators are just a subset of higher order functions

Xarn
Jun 26, 2015

DELETE CASCADE posted:

the term "lambda" being used for anonymous function (or even by extension to a function in general, as in aws) is the bs cs top 50 nerd's absolute favorite kind of term: gatekeeping jargon whose use is unimpeachable due to association with core theory and the legendary church-turing of yore

I still don't understand what's gatekeepy about having terms of trade.

Okay, let's say anonymous function instead of lambda. Do lay people now understand what it means? No, you still have to explain why anonymous functions are considered a separate thing, that there is a distinction between named and unnamed functions, the different approaches towards their scoping, the difference between anonymous and nested functions, and so on. What is the issue of just adding "oh and these are called lambdas for short" on top?

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
you assume they remember or were taught what functions are, irrespective of whether they're anonymous or not...

Kazinsal
Dec 13, 2011



lambdas always remind me of insane math programming poo poo like apl

function pointers are my jam though. you haven't lived until you've used function pointers and macros to JIT BPF bytecode into cache-optimized kernel mode packet classification routines

fisting by many
Dec 25, 2009



echinopsis posted:

i’m working on every aspect of my site at once and currently i’m thinking about fonts now is it possible to buy a font and host it and ask the website to use that?

there are font repositories other than google that have fonts with various definitions of free, but a surprising amount are indeed OFL/free for commercial use.

here's an aggregated blog post with a lot of popular ones, no i didn't write it sorry for the listicle

https://dev.to/qrolic/15-most-amazing-websites-to-download-free-fonts-1imn

Qtotonibudinibudet
Nov 7, 2011



Omich poluyobok, skazhi ty narkoman? ya prosto tozhe gde to tam zhivu, mogli by vmeste uyobyvat' narkotiki
i like the term "inline function" since the location they're defined seems more relevant (since their definition location is key to how they work) than their often being anonymous (which has no meaningful effect on how the function operates). never thought about the C tidbit, though that makes sense now

to xarn's point though it's not a trivial concept no matter what you call it; there's no concise way to say "a function defined within another function whose lexical scope is the dynamic scope of the defining function, also the definitions of lexical and dynamic scope are..."

echinopsis
Apr 13, 2004

by Fluffdaddy

fisting by many posted:

there are font repositories other than google that have fonts with various definitions of free, but a surprising amount are indeed OFL/free for commercial use.

here's an aggregated blog post with a lot of popular ones, no i didn't write it sorry for the listicle

https://dev.to/qrolic/15-most-amazing-websites-to-download-free-fonts-1imn

oh cheers thanks for this. I am 99% settled on the font for my project, in fact I am happy with it, BUT, I am open minded to it being better :D

Deffon
Mar 28, 2010

sb hermit posted:

A function that takes one function and returns another function is generally called a decorator

As explained above, a decorator is a higher-order function whose job is to augment an existing function with extra functionality on top of the original one.

OO people invented a bunch of "patterns" because their languages didn't support higher-order functions. This is such a simple and non-academic concept that you only need a couple of books to explain them.

A constructor is a primary way to create another function based on parts. A copy constructor is the same but the new function is expected to be equivalent to the source. A factory brings in the expectation that the returned function is a subclass of the declared return type etc.

Sometimes these names are useful suffixes if you need to be clear what the purpose of a given function is, but that is often less of a problem when they are short and inline. I don't write function incrementTransformer() { ... } when a => a + 1 is obvious enough.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

CMYK BLYAT! posted:

i like the term "inline function" since the location they're defined seems more relevant (since their definition location is key to how they work) than their often being anonymous (which has no meaningful effect on how the function operates)

"inline function" has a completely different meaning, i.e. a function that gets compiled inline.

that is, instead of the function's code being compiled once into the resulting assembly, and every call site being ultimately a JMP instruction to the function code part, the function's code gets directly copy-pasted after each call site and compiled N times

this is useful if (a) you don't care about seeing a reference to the function in debugging, reflection, etc., and/or (b) you need to squeeze a little bit of performance out of your code.

the archetypical inlining candidates are one-liners. the classic `array.map (x -> x +1)` can get a lot faster on huge arrays if you inline the lambda so the resulting code looks like `for i in 0 .. length-1 do; push(a[i]+1)` instead of `for i in 0 .. length-1 do; push(lambda(a[i]))`. not only that, but in such an example the compiled assembly will actually be more readable instead of less

NihilCredo fucked around with this message at 10:59 on Jun 13, 2022

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.
Lol at saying C doesn't have anonymous functions.

Someone's never seen someone malloc some space, toss some machine code into it, then return the pointer.

Kill me.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Xarn posted:

I still don't understand what's gatekeepy about having terms of trade.

Okay, let's say anonymous function instead of lambda. Do lay people now understand what it means? No, you still have to explain why anonymous functions are considered a separate thing, that there is a distinction between named and unnamed functions, the different approaches towards their scoping, the difference between anonymous and nested functions, and so on. What is the issue of just adding "oh and these are called lambdas for short" on top?

in javascript its gets pretty hard to explain these definitions in practical terms though. for example, none of these functions are anonymous:
code:
function butts() {}
// functions and variables are in the same namespace so you can't actually do this:
let butts = function() {}; // or () => undefined, same thing
let pos = {
  butts: function() {},
  dongs: function butts() {},
};
on all of these, .name will be set to "butts", so they aren't actually anonymous even though they haven't been formally declared with a name. the only real difference between declaring a function and declaring a variable and assigning it a function is that function declarations are hoisted to the top of the scope. the only common situation I can think of where you have an actually anonymous function is when you make one up on the spot to pass as an argument to another function, but even then it's not really that interesting that it's anonymous - it's just a function. what kicked off the entire discussion was just a confusion between passing a function as an argument and passing its return value.

other than the hoisting, the only really important distinction between various kinds of function declarations in javascript is between arrow functions and regular functions, because that changes the behavior of this, so introducing a whole bunch of jargon that doesn't actually have any practical meaning in this language just confuses people. the exception i guess is closure, because that's of course a frequently used concept and one that's important to understand. there are languages where the distinctions you bring up are important, but it's far from universal.

TheFluff fucked around with this message at 16:17 on Jun 13, 2022

hobbesmaster
Jan 28, 2008

leper khan posted:

Lol at saying C doesn't have anonymous functions.

Someone's never seen someone malloc some space, toss some machine code into it, then return the pointer.

Kill me.

C lets you do whatever you want, it owns

gonadic io
Feb 16, 2011

>>=
Typically in those cases it's whatever your untrusted executable has smuggled in as a payload and has swapped with the stack pointer wants

Share Bear
Apr 27, 2004

CPColin posted:

I've been through the lambda on a func with no name

Doom Mathematic
Sep 2, 2008
The function with no name is actually credited as "Joe".

Xarn
Jun 26, 2015

NihilCredo posted:

"inline function" has a completely different meaning, i.e. a function that gets compiled inline.

that is, instead of the function's code being compiled once into the resulting assembly, and every call site being ultimately a JMP instruction to the function code part, the function's code gets directly copy-pasted after each call site and compiled N times

this is useful if (a) you don't care about seeing a reference to the function in debugging, reflection, etc., and/or (b) you need to squeeze a little bit of performance out of your code.

the archetypical inlining candidates are one-liners. the classic `array.map (x -> x +1)` can get a lot faster on huge arrays if you inline the lambda so the resulting code looks like `for i in 0 .. length-1 do; push(a+1)` instead of `for i in 0 .. length-1 do; push(lambda(a[i]))`. not only that, but in such an example the compiled assembly will actually be more readable instead of less

no

at best that is an [i]inlined
function :colbert:

Xarn
Jun 26, 2015
If you are about to start talking about C/C++ functions marked with inline, then remember that the languages like to used words incorrectly, such as functor, move, remove, co_* keywords... :v:

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
words are made up meanings are based on usage

unfortunately. this entails that 'literally' literally doesn't mean literally

Adbot
ADBOT LOVES YOU

gonadic io
Feb 16, 2011

>>=

Xarn posted:

If you are about to start talking about C/C++ functions marked with inline, then remember that the languages like to used words incorrectly, such as functor, move, remove, co_* keywords... :v:

Ask me how I know that inline(always) does not mean always

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