Front Page All Articles Recent Changes Random Article

Contents

Concatenative language

  • ACL
  • Ait
  • Aocla
  • Breeze
  • Callisto
  • Cat
  • Cognate
  • colorForth
  • Concata
  • CoSy
  • Deque
  • DSSP
  • dt
  • Elymas
  • Enchilada
  • ETAC
  • F
  • Factor
  • Fiveth
  • Forth
  • Fourth
  • Freelang
  • Gershwin
  • hex
  • iNet
  • Joy
  • Joy of Postfix App
  • kcats
  • Kitten
  • lang5
  • Listack
  • LSE64
  • Lviv
  • Meow5
  • min
  • Mirth
  • mjoy
  • Mlatu
  • Ode
  • OForth
  • Om
  • Onyx
  • Plorth
  • Popr
  • Porth
  • PostScript
  • Prowl
  • Quest32
  • Quackery
  • r3
  • Raven
  • Retro
  • RPL
  • SPL
  • Staapl
  • Stabel
  • Tal
  • Titan
  • Trith
  • Uiua
  • Worst
  • xs
  • XY
  • 5th
  • 8th

Concatenative topics

  • Compilers
  • Interpreters
  • Type systems
  • Object systems
  • Quotations
  • Variables
  • Garbage collection
  • Example programs

Concatenative meta

  • People
  • Communities

Other languages

  • APL
  • C++
  • Erlang
  • FP trivia
  • Haskell
  • Io
  • Java
  • JavaScript
  • Lisp
  • ML
  • Oberon
  • RPL
  • Self
  • Slate
  • Smalltalk

Meta

  • Search
  • Farkup wiki format
  • Etiquette
  • Sandbox

Quotations

Quotations are the general term for anonymous functions or lambdas. They denote a snippet of code which can be executed later. Their exact syntax varies by language. For example, Factor denotes quotations using square-brackets. Whereas, Tal and Postscript denote them using curly-brackets. Regardless of syntax, they are core to constructing higher-order functions in concatenative languages.

Higher-Order Function

A higher-order function is an operation that utilize other functions as inputs or create new functions as outputs. This feature is leverage by a core utility of concatenative programming: combinators. They enable a programmer to name code not values.

Example of Quotations

Factor

! { 1 4 9 16 }
{ 1 2 3 4 } [ sq ] map 

Kitten

// [10, 20, 30]
[1, 2, 3] { (* 10) } map

Tal

( 02 04 06 08 0a )
{ 01 02 03 04 } { DUP ADD JMP2r } map]

Implementation of %map%:
[tal{@map ( | arr* f* -- arr* )
	SWP2r LITr _&f STR2r
	SWP2r STH2r
	DUP2k #0002 SUB2 LDA2 ADD2 SWP2
	&>l ( -- )
		STH2k LDAk [ LIT2 &f $2 ] JSR2 STH2r STA
		INC2 GTH2k ?&>l
	POP2 POP2 JMP2r

This revision created on Thu, 21 Mar 2024 03:17:08 by neauoire

Latest Revisions Edit

All content is © 2008-2024 by its respective authors. By adding content to this wiki, you agree to release it under the BSD license.