Sha256: 4342c5d149defa1bfa2720ffeca43a19cb1ea73431b60ffb702b3b3403714152

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

(define assess-spreadsheet
  Spreadsheet -> (map (/. Row (assign-fixed-values Row Spreadsheet))
                      Spreadsheet))

(define assign-fixed-values 
   [Index | Cells] Spreadsheet 
   -> [Index | (map (/. Cell (assign-cell-value Cell Spreadsheet)) Cells)]) 

(define assign-cell-value 
   [Attribute Value]  _ -> [Attribute Value] where (fixed-value? Value) 
   [Attribute Value] Spreadsheet -> [Attribute (Value Spreadsheet)])

(define fixed-value?
 \* number?, symbol? and string? are system functions - see appendix A *\
  Value -> (or (number? Value) (or (symbol? Value) (string? Value))))

(define get'
  \* spreads the spreadsheet! *\
  Index Attribute Spreadsheet
   -> (get-row Index Attribute Spreadsheet Spreadsheet))

(define get-row
   \* looks for the right row using the index *\
   Index Attribute [[Index | Cells] | _] Spreadsheet
   -> (get-cell Attribute Cells Spreadsheet)
   Index Attribute [_ | Rows] Spreadsheet
   -> (get-row Index Attribute Rows Spreadsheet)
   Index _ _ _ -> (error "Index ~A not found" Index))

(define get-cell
   Attribute [[Attribute Value] | _] Spreadsheet 
   -> (if (fixed-value? Value) Value (Value Spreadsheet))
   Attribute [_ | Cells] Spreadsheet
   -> (get-cell Attribute Cells Spreadsheet)
   Attribute _ _ -> (error "Attribute ~A not found" Attribute))

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shen-ruby-0.12.1 shen/release/test_programs/spreadsheet.shen
shen-ruby-0.12.0 shen/release/test_programs/spreadsheet.shen
shen-ruby-0.11.0 shen/release/test_programs/spreadsheet.shen