or
> ref-counted datatypes, which can be a
> very useful feature!
>
> Cheers!
>
> Hongwei
>
> PS: Thanks for bringing up this programming challenge :)
>
>
>
> On Fri, Jun 19, 2020 at 2:48 AM August Alm > wrote:
>
>> Wow, many thanks for the heads-up and ef
u have a function find_in_ctx, which
>> requires that
>> the found term to be duplicated (so that the copy is returned while the
>> original one is
>> still kept in the context).
>>
>> I don't yet know if there is a way to circumvent this issue.
>>
It seems that it is patsopt and not gcc that segfaults during compilation.
Where do I start debugging? With runtime crashes I have some ideas (gdb,
valgrind) but segfault during compilation has never happened to me before and I
can't seem to find anything relevant on the web.
--
You received t
My code typechecks but compilation segfaults without explanation. I don't
know how to figure out why. I'd be very grateful if someone is interested in
this project and willing to look at what might be wrong. Complete code here:
https://github.com/August-Alm/Lambda-Calculus-by-Linear-
juni 2020 kl. 23:07:37 UTC+2 skrev August Alm:
>
> Hi, thanks for answering!
>
> I have a semi-educated guess as to how the various ATS-closure
> functions are translated into C. What I was fishing for was rather if
> the details/internals can be exposed from within ATS. E.g.,
; Another suggestion is that you use term_rc (instead of term_vt), where
> 'rc' refers to reference counting.
> Here is an example of reference-counted lists:
>
>
> https://github.com/githwxi/ATS-Temptory/blob/master/libats/SATS/list_rc.sats
>
> Cheers!
>
>
>
skrev artyom.s...@gmail.com:
>>
>> Hi August,
>>
>> This is interesting stuff you’re working on. :)
>>
>> On 7 Jun 2020, at 15:19, August Alm wrote:
>>
>>
>> Hi!
>>
>> For fun, I implemented an interpreter of the untyped lamb
working on. :)
>
> On 7 Jun 2020, at 15:19, August Alm >
> wrote:
>
>
> Hi!
>
> For fun, I implemented an interpreter of the untyped lambda calculus
> in ATS2, using "higher order syntax" (HOAS). HOAS here means that
> everything proceeds from the followin
Hi!
For fun, I implemented an interpreter of the untyped lambda calculus
in ATS2, using "higher order syntax" (HOAS). HOAS here means that
everything proceeds from the following datatype encoding of an abstract
syntax term:
datatype
term_t =
| Var of string
| Lam of (string, term_t - term_t)
functions in ATS3. Such functions are needed in ATS2
> primarily for the sake of selecting template implementations based on
> (dependent) types. In ATS3. template selection is based on the erasures
> of dependent types, which are algebraic (that is, no quantifiers are
> involved).
>
>
Hi!
Jumping straight to it, consider the following types
(here [a: t0ype+], say):
node0_t(a) = @{entry = a, next = ptr}
and
node1_t(a) = [l: addr] @{entry = a, next = ptr(l)}
Using the pure cast-functions [g1ofg0_ptr] and
[g0ofg1_ptr] I can write down corresponding pure
functions [g1ofg0_node]
I have something to add to the wishlist: "better" linear functions.
We had a discussion about this almost a year ago. The issue I raised back
then is that
there is no real way to free a linear function without applying it. This is
not a concern
motivated by category theory or something such, bu
I realize it may have sounded as if I like the feature of being able to write
the same thing in a multitude of ways. I don't. It's something both Scala and
ATS have in common and that I think it's problematic. In both Haskell and C the
are many ways of doing things, but not many ways/styles of w
y in a
C-ish style.
Den tisdag 13 februari 2018 kl. 16:56:52 UTC+1 skrev Artyom Shalkhakov:
If we talk syntax, why not adopt that of C? :-)
>
> 13 февр. 2018 г. 8:43 ПП пользователь "August Alm" > написал:
>
> I second the preference for Haskell-style "let" and &q
I second the preference for Haskell-style "let" and "where", which is to
say no "end"s and no curly braces.
Of course, this requires indentation to be syntactic and not just a matter
of aesthetics/readability. I think this
is a good thing, not just because it is more concise but maybe even more s
efined in the
>> included header files for arduino programming.
>>
>> I made some changes. Please do a git-pull first.
>>
>> There is a newly added example: TEST/StreamOps
>> Please note the following line in the included Makefile:
>>
>> MYCFLAGS += -D_ATS_
Hi!
I am following the Arduino library in ATS contrib and want to try do
something with linear streams.
The convenience file [staloadall.hats] does not load [stream_vt.dats] and
simply adding that
in my preamble does not work -- I get the "not declared" errors:
error: ‘atspre_lazy_vt_free’ was
That simple, huh! Thank you, and thank you for nudging me in other
directions. :)
Den lördag 29 april 2017 kl. 02:20:01 UTC+2 skrev gmhwxi:
>
> The code seems to compile if you just add:
>
> %{^
> #define atspre_malloc_gc malloc
> %}
>
>
> On Fri, Apr 28, 2017 at 6
gt; macdef theArray =
> $extval(arrayref(int,N),"theArray")
> //
>
> In embedded programming, resources are often all allocated at the
> beginning.
> A function like audiobuffer_initize should only do initialization (and do
> no allocation).
>
> On Friday, April 28,
l allocated at the
> beginning.
> A function like audiobuffer_initize should only do initialization (and do
> no allocation).
>
> On Friday, April 28, 2017 at 4:25:30 PM UTC-4, August Alm wrote:
>>
>> Here is a smallish working example: https://glot.io/snippets/epdbih
>
> -- Original message--
>
> *From: *August Alm
>
> *Date: *Fri, Apr 28, 2017 2:25 PM
>
> *To: *ats-lang-users;
>
> *Subject:*Re: [atspre_malloc_gc] on Arduino
>
>
> I'm still not sure what to do.
> Is there even a way to define [arrayptr]-v
xi wrote:
>>
>> I guess that the reason for the failure is due to 'malloc' being not
>> available.
>>
>> One should probably avoid using malloc/free when coding for Arduino. If
>> anything
>> needs to be allocated, trying to do it at compile-t
m my T-Mobile 4G LTE device
>
>
>
>
>
>
>
> -- Original message--
> From: August Alm
> Date: Thu, Apr 27, 2017 5:53 PM
> To: ats-lang-users;
> Subject:[atspre_malloc_gc] on Arduino
>
>
> Hi!
> I am fiddling around with using ATS for Ardu
Hi!
I am fiddling around with using ATS for Arduino, based on the ATS-contrib
folder.
Lots of fun! The following error, though, leaves me clueless as to how to
fix:
In function ‘void*
ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
... error: ‘atspre_malloc_gc’ was not declared in
inear types! Don't fear them. A lot of things
just seem to work out of the box, the way you
mean to write them. The only real "gotchas" are copying/aliasing and scope
restriction.
Den söndag 23 april 2017 kl. 21:16:03 UTC+2 skrev August Alm:
>
> I'm experimenting with s
I'm experimenting with some more imperative programming in ATS and since I
know even less
C than ATS I am having a hard time. I am currently getting the compiler
error
"the size of a stack-allocated array cannot be determined"
and I think this indicative of a fundamentally flawed methodology on
> stream_vt_head_exn tries to free a given stream. In the above case,
> freeing the given stream trigger infinite computation.
>
> In the follow code, 'ns' is leaked:
>
> val from_vt_nine = from_vt(9)
> val- ~stream_vt_cons(nine, ns) = !from_vt_nine
> val ()
Hi!
The following code compiles but segfaults when run:
val from_vt_nine = from_vt(9)
val nine = stream_vt_head_exn(from_vt_nine)
val () = println!(nine: int)
The follwing code, on the other hand, executes as expected:
val from_vt_nine = from_vt(9)
v
; any subsequent call to 'f' are unable to use
> either 'f1' or 'f2'.
>
> I really need to insert some form of checking to stop a lincloptr function
> from being recursively
> defined (via the use of 'fix').
>
>
> On Mon, Apr 17, 2017 at
type an audio
signal can be given. (Essentially, only
streams of ints or floats, I believe). My idea is that it should be
possible to give a very direct implementation of
the block diagram algebra in ATS, that works for signals of any [viewt0ype].
My code so far is here:
https://github.com/Aug
example that I started this thread with.)
Den fredag 14 april 2017 kl. 15:18:57 UTC+2 skrev August Alm:
>
> Great!
>
> The following implementation is maybe cleaner / has better integrity:
>
> absvtype
> hom(a: vt0ype-, b: vt0ype+)
>
>
in y end
>
>
> Also make similar changes to hom_eval and hom_compose. Then the code
> should work (I saw 9 printed out).
>
>
> On Friday, April 14, 2017 at 8:21:22 AM UTC-4, August Alm wrote:
>>
>> Here are two attempts (the "hom" in terms of [option_vt]
;
> This kind of error message indicates that the compiler cannot figure
> out the size of some type. I should be able to tell a bit more if I could
> see the source code.
>
> On Thursday, April 13, 2017 at 5:48:51 PM UTC-4, August Alm wrote:
>>
>> Not as semant
usual compose.
>
> Don't worry about performance at this point; it can be readily fixed if
> needed.
>
> If this can be worked out, then we can go ahead to implement packages
> inspired
> by category theory to support very low-level programming.
>
> Cheers!
>
>
p(f, g), lam($tup(f, g)) => (f.free(); g.free()),
> lam($tup(f, g), x) => g.eval(f.eval(x)))
> end // end of [compare_hom_hom]
>
>
> On Wednesday, April 12, 2017 at 4:55:46 PM UTC-4, gmhwxi wrote:
>>
>> A linear function (lincloptr) must called exactly once. For ur purp
Sorry, missed the link; here: https://glot.io/snippets/eovl9b5fj6
Den onsdag 12 april 2017 kl. 20:26:22 UTC+2 skrev August Alm:
>
> Hi!
>
> The code for my question can be found here:
> It does not compile on glot.io though, for some reason. It does on my
> com
Hi!
The code for my question can be found here:
It does not compile on glot.io though, for some reason. It does on my
computer. The code is:
#include "share/atspre_define.hats"
#include "share/atspre_staload.hats"
#staload UN = "prelude/SATS/unsafe.sats"
not a proof.
>
>
> Sent from my T-Mobile 4G LTE device
>
>
> -- Original message--
>
> *From: *August Alm
>
> *Date: *Wed, Apr 12, 2017 12:43 PM
>
> *To: *ats-lang-users;
>
> *Subject:*Re: using static quantifiers as dynamical terms
>
>
> Hrrm, I
.
The error is caused by [val m = a1+a2] and [val n = b1 + b2]. I've tried
[g0ofg1] and [g1ofg0]
to ensure the types really match but, no luck. Any ideas?
Best wishes,
August
Den onsdag 12 april 2017 kl. 05:26:15 UTC+2 skrev Artyom Shalkhakov:
>
> On Wednesday, April 12, 2017 at 5:16:50
Thanks! I like this solution.
Den onsdag 12 april 2017 kl. 05:26:15 UTC+2 skrev Artyom Shalkhakov:
>
> On Wednesday, April 12, 2017 at 5:16:50 AM UTC+6, August Alm wrote:
>>
>> I have a function that looks as follows:
>>
>> fun{}
>> parallel
I have a function that looks as follows:
fun{}
parallel_composition_aux
{m1, n1, m2, n2: nat}
(m1: int m1, p1: processor(m1, n1), p2: processor(m2, n2)):
processor(m1+m2, n1+n2) =
llam(ys) =
let val (xs1, xs2) = list_vt_split_at(
se of aliasing?
Den torsdag 6 april 2017 kl. 13:55:30 UTC+2 skrev gmhwxi:
>
> This is a typical form of aliasing: One can use both x and x' to
> access the view associated with the data. So caution is needed
> to avoid issues that may be caused by aliasing.
>
> On Thu, Apr
My own solution for creating a duplicate [x'] of [x: a]:
val x' = dataget{a}(x)
val x' = $UN.castvwtp0{a}(x')
It seems to work, at least for [a: vtype].
Den torsdag 6 april 2017 kl. 12:32:50 UTC+2 skrev August Alm:
>
> I just wish I had the knowledge to cont
wrote:
>>
>>> This look like a bug.
>>>
>>> Let me investigate a bit further.
>>>
>>>
>>> On Wed, Apr 5, 2017 at 6:13 PM, August Alm <...> wrote:
>>>
>>>> Hrrm, I see, [gfree_val] lacks implementation! It is up
Hrrm, I see, [gfree_val] lacks implementation! It is up to me as user to
give it meaning.
But shouldn't the compiler warn me that it lacks implementation?
Den onsdag 5 april 2017 kl. 23:42:02 UTC+2 skrev August Alm:
>
> Look at the following short program:
>
>
Look at the following short program:
#include "share/atspre_staload.hats"
#staload UN = "prelude/SATS/unsafe.sats"
implement
main0() = let
datavtype I_dvt(a: t0ype) = I(a) of a
vtypedef int_vt = I_dvt(int)
val z = I(5)
:
>
> stadef
> cont(r: vt0ype) = lam(a: vt0ype) => hom(a, r) - r
>
>
> On Wed, Apr 5, 2017 at 6:35 AM, August Alm > wrote:
>
>> Thank you, that worked like a charm!
>>
>> I have now encountered a compiler error I have not seen before.
>> Se
gust
Den måndag 3 april 2017 kl. 23:18:44 UTC+2 skrev gmhwxi:
>
> You could use 'unit' instead of 'void': unit(): unit
>
> On Monday, April 3, 2017 at 5:04:04 PM UTC-4, August Alm wrote:
>>
>> Great you caught it! Now I almost feel useful.
>>
>>
C-4, gmhwxi wrote:
>>>
>>> What you reported sounds like a bug in the ATS compiler.
>>> Could you make your code accessible for me to take a look?
>>>
>>> Thanks!
>>>
>>> On Monday, April 3, 2017 at 5:40:01 AM UTC-4, August Alm wrote
init) end
>
>
> The use of $tempenver forces the compiler to push 'fopr' into the closure
> generated from compiling foldM_list_vt. The compiler does this
> automatically
> most of the time but the programmer may have to use $tempenver occasionally
> as the underlying alg
to the closure
> generated from compiling foldM_list_vt. The compiler does this
> automatically
> most of the time but the programmer may have to use $tempenver occasionally
> as the underlying algorithm I used is not complete (but more efficient for
> handling
> most cases).
t;> in mapM_list_vt$aux{m}{n}(pfm| xs) end
>>>
>>> So the implementation of mapM_list_vt$fopr cannot be used for the purpose
>>> of compiling mapM_list_vt$aux.
>>>
>>> On Thursday, March 30, 2017 at 6:30:16 PM UTC-4, August Alm wrote:
>
ation.
Den lördag 1 april 2017 kl. 23:16:39 UTC+2 skrev August Alm:
>
> Actually, no, it will not compile with [int] instead of [int_vt]. I can't
> figure out
> where in the code the problem appears; the compiler says
>
> warning: cast to pointer from integer of differe
]] to evade
scope restriction
for lambdas. Is that a good guess?
Den lördag 1 april 2017 kl. 03:53:47 UTC+2 skrev gmhwxi:
>
> Cool!
>
> You could just use int for int_vt, right? Maybe you also wanted
> to try datavtype in this experiment.
>
> On Friday, March 31, 2017 at 9:
I got it working with linear types and cloptr functions, see
https://github.com/August-Alm/ATS-Experiments/blob/master/linear_monads.dats
(I can't get the code to work on glot.io unfortunately.) This is fun!
Den fredag 31 mars 2017 kl. 03:54:01 UTC+2 skrev gmhwxi:
>
> cloref1 vs. clo
one of
the things I am hoping to achieve is to reduce the amount of
book-keeping by tucking it away in a library of some standard monadic
functions.
Den fredag 31 mars 2017 kl. 00:30:16 UTC+2 skrev August Alm:
>
> Great! But ...What just happened, what's the lesson I should take away
les. I saw the following lines after execution:
> 1
> 2
> 3
>
>
> On Thu, Mar 30, 2017 at 5:11 PM, August Alm > wrote:
>
>> I think the problem is with
>>
>> extern fun{a, s: vt0ype}
>> mapM_list_vt$fopr(a): s
>>
>> It doesn't see
gt;
> val xs = $list_vt{int_vt}(I(1), I(2), I(3))
>
> On Thursday, March 30, 2017 at 10:13:04 AM UTC-4, August Alm wrote:
>>
>> Sorry, wrong link. Here is the right one:
>> https://glot.io/snippets/eoh28sd2p4
>>
>> Den torsdag 30 mars 2017 kl. 15:54:08 UTC+2 sk
ctionaries for type
> classes.
>
> I did not go forward right away because I wanted to see more use cases
> involving
> concepts from category theory.
>
> On Thursday, March 30, 2017 at 4:37:47 AM UTC-4, August Alm wrote:
>>
>> Den torsdag 30 mars 2017 kl. 04:
sizing
> proofs of certain props. Kind of like inferring dictionaries for type
> classes.
>
> I did not go forward right away because I wanted to see more use cases
> involving
> concepts from category theory.
>
> On Thursday, March 30, 2017 at 4:37:47 AM UTC-4, August Alm w
> https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/MISC/tempfunctor.dats
>
> On Wednesday, March 29, 2017 at 6:36:02 PM UTC-4, August Alm wrote:
> For fun and learning I tried to do linear monads in a similar spirit, see:
> https://glot.io/snippets/eogc8rdiv1 I get the
For fun and learning I tried to do linear monads in a similar spirit, see:
https://glot.io/snippets/eogc8rdiv1 I get the code
to compile (without the test-case at the end which I've commented out;
don't know what's wrong with that)
but it does not run on glot.io, because of LIBATS/ML-dependency
I guess what I really wanted to ask is: Why not just use an abstract
[FUNCTOR(ftype)] instead of [FUNCTOR(fname: type, ftype), i.e., why insist
on names?
Den onsdag 29 mars 2017 kl. 20:48:51 UTC+2 skrev August Alm:
>
> I liked the sort of reversed perspective! Two objects A and B de
I liked the sort of reversed perspective! Two objects A and B define a "for
all functors F, F_map : F(A) -> F(B)". But having to pass around "F_name"
and introduce a "FUNCTOR_F_elim" seems a bit heavy-handed. Or is there a
possibility that the proof terms can be passed implicitly, like [pfgc:
m
DivideConquer; if it is
> above, then use DivideConquerPar. It is pretty much like doing
> parallelization.
>
> On Wednesday, March 22, 2017 at 7:14:33 PM UTC-4, August Alm wrote:
>>
>> Hi!
>>
>> I am trying to write a function as follows:
>>
>>
code
wouldn't compile without them.
Den tisdag 28 mars 2017 kl. 03:30:11 UTC+2 skrev gmhwxi:
>
>
> Thanks!
>
> I made the code a bit more ATSish:
>
>
> https://github.com/githwxi/ATS-Postiats-contrib/tree/master/contrib/libats-/hwxi/teaching/lens
>
> On Monday, March
I just wrote a toy ATS implementation of lenses, as used in Scala and
Haskell. See
https://github.com/August-Alm/ATS-Experiments/blob/master/lens.dats Lenses
are, in their most basic form, a way to functionally update immutable
tuples and records. Perhaps one could use them to update the
6620580095947431500524025327097469953187707243768259074199396322659841474981936092852239450397071654431564213\
>>
>> 28157688908058783183404917434556270520223564846495196112460268313970975069382648706613264507665074611512677522748621598642530711298441182622661057163\
>>
>> 51506926002986170
I have written what might be considered an implementation of the
divide-and-conquer schema from the Effective ATS series,
using a linear state monad for doing memoization. See
https://github.com/August-Alm/ATS-Experiments The code doesn't
quite compile though. I've worked myself
argely taken from this source:
> https://wiki.haskell.org/State_Monad
>
> On Wednesday, March 22, 2017 at 9:31:50 PM UTC-4, August Alm wrote:
> Thanx! That definitely looks cleaner than what I had. (As you probably
> guessed I tried to do the divide and conquer thing -- i have
/hwxi/teaching/monadlin/DATS/monadlin_state.dats
>
> If you see monads from this angle, then the get/put functions in Haskell
> (for state monads) look quite strange, to say the least.
>
> On Wednesday, March 22, 2017 at 7:14:33 PM UTC-4, August Alm wrote:
>>
>> Hi!
>>
Darn!!! I had just forgotten the "x" in the cast inside the lambda. Took
way too long to notice.. Now with "x" added" it does work. Hope the post is
useful to someone else. =)
Den torsdag 23 mars 2017 kl. 00:14:33 UTC+1 skrev August Alm:
>
> Hi!
>
> I am
Hi!
I am trying to write a function as follows:
fun
return
{s: vt0p}{a: vt0p}
(x: a): (s - (s, a))
= let val x = $UN.castvwtp0{ptr}(x)
in lam(st) = let val x = $UN.castvwtp0{a} in (st, x) end
end
With non-linear types it'd be fine to write [ret
a (non-linear value).
>
> Of course, this is all intuition. It would require a huge effort to
> actually build
> a model for only the core of ATS.
>
>
> On Saturday, March 18, 2017 at 9:00:33 PM UTC-4, August Alm wrote:
>>
>> I know T in VT = (V | T) can be gotte
g the error messages myself.
Best wishes,
August
Den lördag 18 mars 2017 kl. 09:06:34 UTC+1 skrev Artyom Shalkhakov:
>
> Hi August,
>
> On Thursday, March 16, 2017 at 9:20:54 PM UTC+6, August Alm wrote:
>>
>> Hi all!
>>
>> I just wrote down some sketchy thoughts on mo
e exists a view V and a type T such that
>
> VT = (V | T)
>
>
> *The linearity of a viewtype entirely comes from the linearity of the
> viewinside it.*
>
> On Thursday, March 16, 2017 at 11:20:54 AM UTC-4, August Alm wrote:
>>
>> Hi all!
>>
>> I just wrot
C: type ->
viewtype. There is a sort of trivial inclusion J: type -> viewtype given by
wrapping in a dataviewtype (so
datavtype J(a: type) = J of a) and one can regard C as a comonad relative
to J.
Den fredag 17 mars 2017 kl. 21:52:42 UTC+1 skrev Steinway Wu:
>
> Great note!
>
>
Hi all!
I just wrote down some sketchy thoughts on monads and comonads in ATS. ATS
has a very unique type system, so there are (co)monads in ATS that simply
do not exist in other languages. I'm wondering if this might be useful. See
the attached and let me know if you have ideas.
Best wishes,
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
iable:
>
> implement {CSVErrors} extfree(errs) = ...
>
> What you need is
>
> implement extfree(errs) = free(errs)
>
> On Tuesday, March 14, 2017 at 9:35:36 AM UTC-4, August Alm wrote:
>>
>> Great application of "reassume"! =D I had to reinstall ATS2
gt;
>
> On Mon, Mar 13, 2017 at 9:09 PM, Hongwei Xi > wrote:
>
> This is because CSVErrors is a dependent type.
>
> The right way to do it is to make CSVErrors abstract.
>
> If you are using ATS2-0.3.3, then you can use the feature of 'reassume'.
> I will show
uot;
Den tisdag 14 mars 2017 kl. 00:57:18 UTC+1 skrev August Alm:
>
> Yes, as you guessed I am having problems with covariance. Some I have
> solved but this one leaves me very puzzled:
>
> I'll copy the code here in the order that it appears in my file. First (in
> "csv
nt_vtype of CSVError?
Den måndag 13 mars 2017 kl. 23:42:03 UTC+1 skrev gmhwxi:
>
> Once INV annotation is done properly, template annotation can be pretty
> much removed.
>
>
> On Mon, Mar 13, 2017 at 6:39 PM, August Alm > wrote:
>
>> Thanks for the hint! I added te
erence in ATS is quite limited :)
>
> On Mon, Mar 13, 2017 at 4:51 PM, August Alm > wrote:
>
>> So... I added some "second stage" parsing functionality, to get the en
>> result in tabular form rahter than as a single [stream_vt], and to check
>> for global
Always segfault. Compiling with the "-verbose"
flag prints
exec(patsopt --output csv_lexer_dats.c --dynamic csv_lexer.dats)
Segmentation fault
exec(patsopt --output csv_lexer_dats.c --dynamic csv_lexer.dats) = 35584
which does not tell me anything.
My code can be found at https://gith
t project(s) I
will try to heed your words.
I know that this may sound a bit vague but that is my point. Being vague
> makes people
> think more and more deeply :)
>
> Cheers!
>
>
> On Tuesday, March 7, 2017 at 4:52:58 PM UTC-5, August Alm wrote:
>>
>> I'm glad
as readability of code is concerned.
How does my vtypedef-version compare with your datavtype-version in terms
of efficiency? Is there a clear optimization reason to choose one over the
other?
Den onsdag 8 mars 2017 kl. 10:18:45 UTC+1 skrev August Alm:
>
> I see. Yes, being able
tate) = let
> //
> val+CSVState(x0) = state in x0.tableRow
> //
> end // end of [CSVState_get_tableRow]
> implement
> {}
> CSVState_set_tableRow
> (state, i0) = let
> //
> val+@CSVState(x0) = state in x0.tableRow := i0; fold@(state)
> //
> end // end of [CSVState_se
> implement{} lex_csv$QNLIN() = false
> implement{} lex_csv$DELIM() = ',' // default value
>
> Writing function templates (instead of functions) enables you to move
> your code around very conveniently. You can even move template code
> into the body of another functi
The code now seems to work as inteded!
https://github.com/August-Alm/ats_csv_lexer
Thank you for all the help. I still don't fully grokk why the function
needs to consume each of its arguments--will have to meditate more on
that--but at least I know how to write code like this from n
.stringbuf, cs: llstring): stream_vt(DT) =
>
> The 'acc' stringbuf needs to be consumed by 'test'. The implementation
> of 'test' looks like this:
>
> $ldelay
> (
>
> ,
> (freeing(acc); freeing(cs)) // this part is executed when the stream is
ng example (for computing Mersenne primes) can
> run for days without run-time GC:
>
>
> https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/RosettaCode/Lucas-Lehmer_test2.dats
>
> It convincingly attests to the power of linear streams.
>
> Cheers!
>
>
>
d stream is neede.
>> Sometimes, this is call full laziness. Without full laziness, a stream may
>> behave like a list, defeating the very purpose of using a stream.
>>
>> On Saturday, March 4, 2017 at 7:27:03 PM UTC-5, August Alm wrote:
>>>
>>> I've
d
at GitHub: https://github.com/August-Alm/ats_csv_lexer Any and all comments
on how to improve are appreciated.
Best wishes, August.
Den fredag 3 mars 2017 kl. 23:57:54 UTC+1 skrev gmhwxi:
>
> One possibility is to build a npm package and then publish it.
>
> If you go to https://w
d. You
> just need to identify the function or functions that cause the deep stack
> usage. Then try to rewrite using tail-recursion.
>
>
>
> On Fri, Mar 3, 2017 at 5:25 PM, August Alm > wrote:
>
>> Hi!
>> I had indeed made a logical error that caused any stream
gt; val ins = streamize_fileref_char(inp)
>> val ins = stream2list_vt(ins)
>> val ins = g0ofg1(list_vt2t(ins))97
>> val ( ) = println! ("length(ins) = ", length(ins))
>> val ( ) = (ins).foreach()(lam c => println!(char2int0(c)))
>> (*
>> val lexed
Just "a;b", or? (Attached.)
Den fredag 3 mars 2017 kl. 03:03:08 UTC+1 skrev gmhwxi:
>
> I suspect that the file you used contains other characters.
>
> What is in "small.csv"?
>
> On Thu, Mar 2, 2017 at 8:52 PM, August Alm > wrote:
>
>> The fil
sion in that?
Thank you,
August
Den torsdag 2 mars 2017 kl. 23:04:35 UTC+1 skrev August Alm:
>
> 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! Howe
This works for me:
$ patscc -O2 -D_GNU_SOURCE -DATS_MEMALLOC_LIBC -latslib -lrt -o timer
timer.dats
Den fredag 3 mars 2017 kl. 02:16:49 UTC+1 skrev spearman:
>
> What is the command to compile the `timer.dats` example from the
> Introduction to ATS book?
>
>
> https://github.com/ats-lang/ats-l
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
1 - 100 of 109 matches
Mail list logo