Front Page All Articles Recent Changes Random Article

Contents

Concatenative language

  • ACL
  • Ait
  • Aocla
  • Breeze
  • Cat
  • Cognate
  • colorForth
  • CoSy
  • Deque
  • Elymas
  • Enchilada
  • ETAC
  • F
  • Factor
  • Forth
  • Freelang
  • Gershwin
  • Joy
  • Kitten
  • lang5
  • Lviv
  • min
  • mjoy
  • Mlatu
  • Ode
  • Om
  • Onyx
  • Plorth
  • Popr
  • Porth
  • PostScript
  • Quackery
  • r3
  • Raven
  • Retro
  • Staapl
  • Stabel
  • Trith
  • Worst
  • xs
  • XY
  • 5th
  • 8th

Other languages

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

Computer Science

  • Type systems
  • Language paradigms
  • Compilers
  • Interpreters
  • Garbage collection

Meta

  • Search
  • Farkup wiki format
  • People
  • Etiquette
  • Sandbox

Concatenative language/Keyword parameters

Many languages, such as Common Lisp and Smalltalk, support named parameters at the call site:

(send-email
  :from "jack@aol.com"
  :to (list "jill@aol.com")
  :subject "Hello there"
  :body body)

In Factor, the closest equivalent is to define a tuple and set its slots, then pass it to another word. This looks very nice in Factor, because tuple slot setters leave the tuple on the stack, and so can be chained together without any stack shuffling:

<email>
    "jack@aol.com" >>from
    { "jill@aol.com" } >>to
    "Hello there" >>subject
    body >>body
send-email

This idiom does not depend on any additional language features, and indeed it is more flexible because we can factor out some of the setter calls into a new word. We can also pass around the email object without sending it off immediately.

This revision created on Fri, 2 Jan 2009 19:55:35 by slava

Latest Revisions Edit

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