This is the code:
import structs/[ArrayList, List]
a := [1, 2, 3] as ArrayList<Int>
b := a map(func (value: Int) -> String { value toString()})
b join(", ") println()
When I run the above code with rock I get this:
(SIGSEGV) segmentation fault
[lang/Backtrace] Falling back on execinfo.. (build extension if you want fancy backtraces)
./GenericFuncInClassTest(lang_Backtrace__BacktraceHandler_backtrace_impl+0xf0) [0x44275e]
./GenericFuncInClassTest(lang_Backtrace__BacktraceHandler_backtrace+0x20) [0x443398]
./GenericFuncInClassTest(lang_Exception__Exception_getCurrentBacktrace+0x22) [0x42fa2b]
./GenericFuncInClassTest(lang_Exception___signalHandler+0x1a7) [0x43098b]
/lib/x86_64-linux-gnu/libc.so.6(+0x36d40) [0x7f3b701a8d40]
./GenericFuncInClassTest(structs_List__List_itemsSizeInBytes_impl+0x72) [0x43a056]
./GenericFuncInClassTest(structs_List__List_itemsSizeInBytes+0x23) [0x43a97c]
./GenericFuncInClassTest(structs_List__List_join_string_impl+0x20) [0x43a11f]
./GenericFuncInClassTest(structs_List__List_join_string+0x2e) [0x43a9d1]
./GenericFuncInClassTest(GenericFuncInClassTest_load+0x1b9) [0x42b596]
./GenericFuncInClassTest(main+0x1e) [0x42b5d5]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f3b70193ec5]
./GenericFuncInClassTest() [0x42b319]
Am I doing anything wrong or is this an issue with rock?
/Jonathan
--
You received this message because you are subscribed to the Google Groups "ooc-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ooc-lang+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thank you it works now
/Jonathan
I ran into a new problem when trying to implement fold.
This is the fold code:
fold: func <T,S> (function: Func(T, S) -> S, initial: S) -> S {
for(i in 0..this count)
initial = function(this[i], initial)
initial
}
This is how I'm trying to use it:
import structs/[ArrayList, List]
a := [1, 2, 3] as ArrayList<Int>
b := a fold(|x, y| x toString() + y, "START")
And this is the error:
rock/./GenericFuncInClassTest.ooc:5:8 error Not enough info to resolve return type S of function call
b := a fold(|x, y| x toString() + y toString(), "START")
Is there a way to write the code to make it understand the return type?
/Jonathan
/Jonathan