File: hash.rb

package info (click to toggle)
mikutter 5.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,780 kB
  • sloc: ruby: 22,912; sh: 186; makefile: 21
file content (30 lines) | stat: -rw-r--r-- 359 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
require_relative 'list'

class Hash
  include MIKU::List

  def car
    first
  end

  def cdr
    to_a[1..]
  end

  def terminator
    nil end

  def setcar(val)
    to_a.setcar(val)
  end

  def setcdr(val)
    to_a.setcdr(val)
  end

  def unparse(start=true)
    "#hash(" + map{ |n| "#{n[0]} #{n[1]}" }.join(" ") + ')'
  end

end