Hooray! So did I. :) Thanks for, well everything.

Am I correct in believing there is some sort of tutorial on how to best 
publish ATS packages using NPM in the pipeline?

Den tisdag 14 mars 2017 kl. 23:57:39 UTC+1 skrev gmhwxi:
>
>
> Here is a way to fix it:
>
> fun {a, b: vt0ype}
> stream_vt_usermap (
>     xs: stream_vt(a),
>     f: a -<cloref1> b
>   ) : stream_vt(b) = let
>     implement stream_vt_usermap$fopr<a, b>(x) = f(x)
>   in stream_vt_usermap_aux(xs) end
>
> When using stream_vt_usermap, please pass lam(r) => extract_errs(r)
>
> There are two other places where you need this kind of change. Then you
> should be able to compile the entire program. I just did.
>
> On Thursday, March 2, 2017 at 5:04:35 PM UTC-5, August Alm wrote:
>>
>> Hi!
>>
>> I'm in over my head and tried writing a CSV-parser using linear lazy 
>> streams. My code thus far is 600 lines and almost to my own surprise I get 
>> it to compile! However, there is something fishy because I get a segfault 
>> when applying my program to an actual CSV-file. I've been trying to debug 
>> using gdb but the fault eludes me. Since I don't expect anyone to mull 
>> through 600 lines of code, I am hoping these code snippets are enough for 
>> one of you guys to give me some advice.
>>
>> This code executes just fine:
>>
>>         implement main0 () = {
>>            
>>            val test = stream_vt_make_cons(
>>                             'a', stream_vt_make_cons(
>>                                     ';', 
>> stream_vt_make_sing('b')))          (* the stream ('a', ';', 'b') *)
>>            val lexed = lex_csv(true, ';', test)
>>            val h = (lexed.head())
>>            val- CSV_Field(r) = h
>>            val a = r.csvFieldContent
>>            val () = println!(a)
>>          
>>          }
>>
>> Here [lex_csv] is my 600-line alogrithm. It reads a [stream_vt(char)] and 
>> gives back a [stream_vt(CSVEntry)], where [CSVEntry] is a record type, one 
>> of whose fields is [CSVFieldContent]. When executing the program I get "a" 
>> printed to the console.
>>
>> This code results in a segfault:
>>
>>         implement main0 () = {
>>         
>>            val inp = fileref_open_exn("small.csv", file_mode_r)
>>            val ins = streamize_fileref_char(inp)
>>            val lexed = lex_csv(true, ';', ins)
>>            val () = fileref_close(inp)
>>            val h = (lexed.head())
>>            val- CSV_Field(r) = h
>>            val a = r.csvFieldContent
>>            val () = println!(a)
>>          
>>          }
>>
>> The file "small.csv" only contains the string "a;b". Hence I would expect 
>> this code to give the result as the previous one! But, it doesn't just 
>> return something else, it segfaults.
>>
>> gdb indicates there is a malloc problem having to do with 
>> "GC_clear_stack_inner", in case that's helpful. (I'm a mathematician who 
>> recently left academia after postdoc and decided to teach myself 
>> programming to become more useful outside of academia; hence I understand 
>> type systems and the like--the mathy stuff--a lot better than I understand 
>> memory allocation and other stuff that most programmers are supposed to be 
>> confident with.)
>>
>> What could be the problem here?
>>
>> Best wishes,
>> August
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/1fb5227d-47ff-424a-941d-416ded61dfdb%40googlegroups.com.

Reply via email to