+ifneq ($(shell which xcrun),)
+ SWIFT = xcrun -sdk macosx swiftc
+else
+ SWIFT = swiftc
+endif
+
STEP3_DEPS = Sources/types.swift Sources/reader.swift Sources/printer.swift Sources/env.swift
STEP4_DEPS = $(STEP3_DEPS) Sources/core.swift
step4_if_fn_do step5_tco step6_file step7_quote step8_macros step9_try stepA_mal: $(STEP4_DEPS)
step%: Sources/step%/main.swift
- swiftc $+ -o $@
+ $(SWIFT) $+ -o $@
clean:
rm -f $(STEPS) mal
// TODO: remove this once time-ms and slurp use standard library calls
+
+#if os(Linux)
import Glibc
+#else
+import Darwin
+#endif
func IntOp(op: (Int, Int) -> Int, _ a: MalVal, _ b: MalVal) throws -> MalVal {
switch (a, b) {
},
"pr-str": {
- return MV.MalString($0.map { pr_str($0,true) }.joinWithSeparator(" "))
+ // TODO: if the following two statements are combined into one, we get
+ // the following error message. It's not clear to me that there's
+ // actually any error, so this might be a compiler issue.
+ //
+ // Sources/core.swift:29:59: error: type of expression is ambiguous without more context
+ // let core_ns: [String: (Array<MalVal>) throws -> MalVal] = [
+ // ^
+
+ let s = $0.map { pr_str($0,true) }.joinWithSeparator(" ")
+ return MV.MalString(s)
},
"str": {
- return MV.MalString($0.map { pr_str($0,false) }.joinWithSeparator(""))
+ // The comment for "pr-str" applies here, too.
+ let s = $0.map { pr_str($0,false) }.joinWithSeparator("")
+ return MV.MalString(s)
},
"prn": {
print($0.map { pr_str($0,true) }.joinWithSeparator(" "))