Re: Best way to handle short-living linear objects

2017-10-20 Thread gmhwxi

No, you don't. You can use reference counting. See the libfloats
package I posted in my previous message.

On Friday, October 20, 2017 at 10:29:19 AM UTC-4, Russoul wrote:
>
> Yes, but that is not modular. What if I need the inputs later ? Then I'll 
> have to copy them. Consuming the inputs is also a bit confusing.
>
> пятница, 20 октября 2017 г., 17:21:27 UTC+3 пользователь Steinway Wu 
> написал:
>>
>> I guess you can define \cross and * as functions that consume the linear 
>> lists and return a new one? 
>>
>> On Friday, October 20, 2017 at 10:11:00 AM UTC-4, Russoul wrote:
>>>
>>> Let's treat `list_vt(a,n)` as algebraic vector of dim 'n'. Then let's 
>>> perform some operations on a bunch of them:
>>>
>>> (*pseudocode*)
>>> ...
>>> val a = $list_vt(1,0,0)
>>> val b = $list_vt(0,1,0)
>>> val c = a \cross b
>>> val d = c * PI
>>> ...
>>> val _ = free a
>>> val _ = free b
>>> val _ = free c
>>> val _ = free d
>>> (*end of code fragment*)
>>>
>>> Cleaning(freeing) after simple algebraic operations in the above example 
>>> is tedious. And I suppose it can become a real pain in math extensive code.
>>> What is the way out ?
>>>
>>>

-- 
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 ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/975e2ed9-4967-486e-ac64-3a8d6f0e05da%40googlegroups.com.


Re: Best way to handle short-living linear objects

2017-10-20 Thread gmhwxi

This issue is related to the way library functions are implemented.
For instance, \cross may free both of its arguments.

A few years ago, I did a package for doing linear algebra:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/contrib/libfloats

And you may take a look at the function interface:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/contrib/libfloats/SATS

In this day and age of machine learning, I may need to revisit this package 
:)


On Friday, October 20, 2017 at 10:11:00 AM UTC-4, Russoul wrote:
>
> Let's treat `list_vt(a,n)` as algebraic vector of dim 'n'. Then let's 
> perform some operations on a bunch of them:
>
> (*pseudocode*)
> ...
> val a = $list_vt(1,0,0)
> val b = $list_vt(0,1,0)
> val c = a \cross b
> val d = c * PI
> ...
> val _ = free a
> val _ = free b
> val _ = free c
> val _ = free d
> (*end of code fragment*)
>
> Cleaning(freeing) after simple algebraic operations in the above example 
> is tedious. And I suppose it can become a real pain in math extensive code.
> What is the way out ?
>
>

-- 
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 ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/56e0fd58-9a0c-4ddb-889c-5e7c1f38f30c%40googlegroups.com.


Re: Best way to handle short-living linear objects

2017-10-20 Thread Russoul
Yes, but that is not modular. What if I need the inputs later ? Then I'll 
have to copy them. Consuming the inputs is also a bit confusing.

пятница, 20 октября 2017 г., 17:21:27 UTC+3 пользователь Steinway Wu 
написал:
>
> I guess you can define \cross and * as functions that consume the linear 
> lists and return a new one? 
>
> On Friday, October 20, 2017 at 10:11:00 AM UTC-4, Russoul wrote:
>>
>> Let's treat `list_vt(a,n)` as algebraic vector of dim 'n'. Then let's 
>> perform some operations on a bunch of them:
>>
>> (*pseudocode*)
>> ...
>> val a = $list_vt(1,0,0)
>> val b = $list_vt(0,1,0)
>> val c = a \cross b
>> val d = c * PI
>> ...
>> val _ = free a
>> val _ = free b
>> val _ = free c
>> val _ = free d
>> (*end of code fragment*)
>>
>> Cleaning(freeing) after simple algebraic operations in the above example 
>> is tedious. And I suppose it can become a real pain in math extensive code.
>> What is the way out ?
>>
>>

-- 
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 ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/859ccbb6-1a42-4404-81af-25f3a4ce4f37%40googlegroups.com.


Re: Best way to handle short-living linear objects

2017-10-20 Thread Steinway Wu
I guess you can define \cross and * as functions that consumes the linear 
list and return a new one? 

On Friday, October 20, 2017 at 10:11:00 AM UTC-4, Russoul wrote:
>
> Let's treat `list_vt(a,n)` as algebraic vector of dim 'n'. Then let's 
> perform some operations on a bunch of them:
>
> (*pseudocode*)
> ...
> val a = $list_vt(1,0,0)
> val b = $list_vt(0,1,0)
> val c = a \cross b
> val d = c * PI
> ...
> val _ = free a
> val _ = free b
> val _ = free c
> val _ = free d
> (*end of code fragment*)
>
> Cleaning(freeing) after simple algebraic operations in the above example 
> is tedious. And I suppose it can become a real pain in math extensive code.
> What is the way out ?
>
>

-- 
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 ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/c0605c82-f53e-4434-857e-3a194a852a2b%40googlegroups.com.


Best way to handle short-living linear objects

2017-10-20 Thread Russoul
Let's treat `list_vt(a,n)` as algebraic vector of dim 'n'. Then let's 
perform some operations on a bunch of them:

(*pseudocode*)
...
val a = $list_vt(1,0,0)
val b = $list_vt(0,1,0)
val c = a \cross b
val d = c * PI
...
val _ = free a
val _ = free b
val _ = free c
val _ = free d
(*end of code fragment*)

Cleaning(freeing) after simple algebraic operations in the above example is 
tedious. And I suppose it can become a real pain in math extensive code.
What is the way out ?

-- 
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 ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/0506aede-b032-43ea-bb9d-f97391015285%40googlegroups.com.