Skip to main content
added 176 characters in body
Source Link
cat
  • 6.1k
  • 2
  • 27
  • 45

quotations are lambdas, abuse them

Most challenges can be solved with one word definition because of Factor's functional, applicative nature.

I just had the sudden realisation that [ quoting ] code is the equivalent of a lambda definition in other languages.

I don't know why I didn't think of this before...

A normal word definition:

: f ( a c -- b ) asd asd ;

Lamba'd:

[ asd asd ]

You can do everything inside a [ quotation ] that you can inside a : word.

quotations are lambdas, abuse them

Most challenges can be solved with one word definition because of Factor's functional, applicative nature.

I just had the sudden realisation that [ quoting ] code is the equivalent of a lambda definition in other languages.

I don't know why I didn't think of this before...

quotations are lambdas, abuse them

Most challenges can be solved with one word definition because of Factor's functional, applicative nature.

I just had the sudden realisation that [ quoting ] code is the equivalent of a lambda definition in other languages.

I don't know why I didn't think of this before...

A normal word definition:

: f ( a c -- b ) asd asd ;

Lamba'd:

[ asd asd ]

You can do everything inside a [ quotation ] that you can inside a : word.

Source Link
cat
  • 6.1k
  • 2
  • 27
  • 45

quotations are lambdas, abuse them

Most challenges can be solved with one word definition because of Factor's functional, applicative nature.

I just had the sudden realisation that [ quoting ] code is the equivalent of a lambda definition in other languages.

I don't know why I didn't think of this before...