Since 4.ss in srfi is nothing other than:<br><br>(require (matching-identifiers-in #px"\\b_?[suf](8|16|32|64)vector\\b"<br> scheme/foreign))<br>(provide (all-from-out scheme/foreign))<br>
<br>I assume just requiring SRFI 4 is negligible overhead and I might as well just use it.<br><br>Doug<br><br><div class="gmail_quote">On Fri, Dec 18, 2009 at 11:45 AM, Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The two different -> s are really different things, so when you have<br>
both of them in a single file you need to do something to distinguish<br>
between them. I think that in this case, probably the best thing is to<br>
prefix the foreign imports with, say, f:.<br>
<br>
Robby<br>
<br>
On Fri, Dec 18, 2009 at 12:42 PM, Doug Williams<br>
<div><div></div><div class="h5"><<a href="mailto:m.douglas.williams@gmail.com">m.douglas.williams@gmail.com</a>> wrote:<br>
> I just tried removing my dependency on SRFI 4 by using the scheme/foreign<br>
> module (which also defines them). However, when I require the scheme/foreign<br>
> module, I have a problem. It has the following snippet of code:<br>
><br>
> (provide ->) ; to signal better errors when trying to use this with<br>
> contracts<br>
> (define-syntax -><br>
> (syntax-id-rules ()<br>
> [_ (raise-syntax-error '-> "should be used only in a _fun context")]))<br>
><br>
> So, my function contracts in the requiring module now give an error.<br>
><br>
> I've never used the FFI interface, but I can see that it uses -> as part of<br>
> the syntax for defining foreign functions. But, the comment "to signal<br>
> better errors when trying to use this with contracts" would imply it is<br>
> supposed to help me somehow, not disallow the use of function contracts with<br>
> something that requires scheme/foreign. Am I missing something?<br>
><br>
><br>
> On Fri, Dec 18, 2009 at 10:02 AM, Doug Williams<br>
> <<a href="mailto:m.douglas.williams@gmail.com">m.douglas.williams@gmail.com</a>> wrote:<br>
>><br>
>> Matthew,<br>
>><br>
>> Attached is a zip file with some homogeneous vector and array code I was<br>
>> working on in the past. The code in vtype.ss abstracts the definitions of<br>
>> the various SFRI 4 vector types (and regular Scheme vectors). The vector<br>
>> types it knows about are object (i.e., straight Scheme heterogeneous<br>
>> vectors), u(8,16,32,64), s(8,16,32,64), and f(32,64). There are also complex<br>
>> vectors of the numeric types cu(8,16,32,64), cs(8,16,32,64), and cf(32,64).<br>
>> The code in type-vector.ss abstracts the vector types describes in vtype.ss<br>
>> into a single typed-vector type. The code in array.ss provides the array<br>
>> abstraction with the underlying data stored as a typed-vector. Finally, the<br>
>> array-test.ss test the array abstraction. [Just running array-test.ss will<br>
>> give you a pretty good idea about the array abstraction.]<br>
>><br>
>> The intent is to provide a homogeneous array implementation similar to the<br>
>> underlying arrays in Matlab (or numpy in Python). This is what I would like<br>
>> to make more efficient and better integrated into the rest of PLT Scheme.<br>
>><br>
>> So, I guess the questions are:<br>
>><br>
>> 1) Should I skip SRFI 4 altogether? The SRFI 4 implementation just exports<br>
>> things from scheme/foreign, so it would probably make sense to go straight<br>
>> to it. But, I am also using the naming convention from SRFI 4.<br>
>><br>
>> 2) How would array slicing best look syntactically? I have a simple<br>
>> slicing capability there now so you can see what it looks like. But<br>
>> basically, for any dimension, you can specify a list (start end step) and<br>
>> any element can be wildcarded using * - also, the whole dimension can be<br>
>> wildcarded. Efficient slicing (e.g., no copying required) is an important<br>
>> element of the design.<br>
>><br>
>> 3) How would we best tie it to the rest og PLT Scheme? In particular, it<br>
>> would be nice to have efficient implementations of the various for routines<br>
>> that just strided through the underlying vector efficiently. But, I think<br>
>> that will require knowledge of the underlying vector type. etc and might be<br>
>> a lot of work.<br>
>><br>
>> So, I think getting a really efficient implementation would require<br>
>> significant coordination with the PLT developers. My long-term goal (as<br>
>> you've probably heard me say before) is to get a Matlab-like (or<br>
>> Matlab-lite) analysis capability.<br>
>><br>
>> Any thoughts?<br>
>><br>
>> Doug<br>
>><br>
>> On Fri, Dec 18, 2009 at 8:41 AM, Matthew Flatt <<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>> wrote:<br>
>>><br>
>>> In case anyone is already using the `flvector' operations, they've<br>
>>> moved to a new `scheme/flonum' library.<br>
>>><br>
>>> (I'm preparing a post about `scheme/flonum' for the plt-scheme list.)<br>
>>><br>
>>><br>
>>><br>
>>> _________________________________________________<br>
>>> For list-related administrative tasks:<br>
>>> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-dev" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-dev</a><br>
>><br>
><br>
><br>
> _________________________________________________<br>
> For list-related administrative tasks:<br>
> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-dev" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-dev</a><br>
><br>
><br>
</div></div></blockquote></div><br>