mirror of
https://github.com/kanaka/mal.git
synced 2024-11-10 02:45:44 +03:00
20 lines
553 B
Swift
20 lines
553 B
Swift
//******************************************************************************
|
|
// MAL - printer
|
|
//******************************************************************************
|
|
|
|
import Foundation
|
|
|
|
func with_print_readably<T>(print_readably: Bool, fn: () -> T) -> T {
|
|
let old = MalValPrintReadably
|
|
MalValPrintReadably = print_readably
|
|
let result = fn()
|
|
MalValPrintReadably = old
|
|
return result
|
|
}
|
|
|
|
func pr_str(m: MalVal, print_readably: Bool) -> String {
|
|
return with_print_readably(print_readably) {
|
|
m.description
|
|
}
|
|
}
|