class Alda::InlineLisp

An inline lisp event. An Alda::EventContainer containing an Alda::InlineLisp can be derived using event list sugar. See Alda::EventList#method_missing.

Sometimes you need help from Alda::LispIdentifier.

It serves as attributes in alda codes. do
  tempo! 108
  quant! 200
  piano_ c e g violin_ g2 e4

Here, tempo! 108 and quant! 200 are inline lisp events and serves for alda attributes.

It can participate in the sequence sugar if it is at the end of the sequence. do
  piano_ c d e quant 200
  g o! c o? c2

You can operate a score by purely using inline lisp events. do
  part 'piano'
  key_sig [:d, :major]
  note pitch :d
  note pitch :e
  note pitch(:f), duration(note_length 2)

When using event list sugar to create inline lisp events, note that it is not previously defined as a variable. See Alda::SetVariable and Alda::GetVariable. do
  p barline.event.class # => Alda::InlineLisp
  barline__ c d e f
  p barline.event.class # => Alda::GetVariable

Whether it is an Alda::SetVariable, Alda::InlineLisp, or Alda::GetVariable is intelligently determined. do
  p((tempo 108).event.class)  # => Alda::InlineLisp
  p tempo { c d }.event.class # => Alda::SetVariable
  p tempo.event.class         # => Alda::GetVariable
  p((tempo 60).event.class)   # => Alda::InlineLisp
  p to_s
  # => "piano: (tempo 108) tempo = [c d]\n tempo (tempo 60)"

If you want, you can generate lisp codes using ruby. do
  println reduce _into_, {}, [{dog: 'food'}, {cat: 'chow'}] 'temp.clj'
`clj temp.clj` # => "[[:dog food] [:cat chow]]\n"



The arguments passed to the lisp function.

Its elements can be any object that responds to to_alda_code and detach_from_parent.


The function name of the lisp function

Public Class Methods

new(head, *args) → Alda::InlineLisp click to toggle source

Creates a new Alda::InlineLisp.

The underlines “_” in head will be converted to hyphens “-”.

# File lib/alda-rb/event.rb, line 315
def initialize head, *args
  @head = head.to_s.gsub ?_, ?-
  @args = args

Public Instance Methods

on_contained() click to toggle source
Calls superclass method Alda::Event#on_contained
# File lib/alda-rb/event.rb, line 324
def on_contained
to_alda_code() click to toggle source
# File lib/alda-rb/event.rb, line 320
def to_alda_code
  "(#{head} #{ ' '})"