Open LunNova opened 1 year ago
scopes: /build/source/llvm/lib/IR/Globals.cpp:366: llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*, bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, const llvm::Twine&, llvm::GlobalVariable*, llvm::GlobalValue::ThreadLocalMode, llvm::Optional<unsigned int>, bool): Assertion `!Ty->isFunctionTy() && PointerType::isValidElementType(Ty) && "invalid type for global variable"' failed.
Tried to test with debug llvm but falls over with this, looks like #19
Suggested workaround: don't use cons lists outside of sugars:
fn sum-group-priorities (input)
returning i32
+ local dst : (Array String)
->>
string-split-generator input h"\n"
cascade
take 3
- 'cons-sink '()
- map find-common-n
+ view dst
+ map (inline (lists) (defer 'clear lists) (find-common-n lists))
map item-priority
reduce-sum 0
Having to manually clear the local array on the first sink after the cascade is pretty jank.
Example code here:
https://github.com/LunNova/scopes-learning/blob/b438933c1e14e9658f1fa3c357d501fadb7c0fd4/aoc/3.sc#L69
Further discussion happened on discord, didn't get anywhere useful.
Haven't worked out a proper mcve.