[Grace-core] Collections suggestion

James Noble kjx at ecs.vuw.ac.nz
Tue Jul 29 23:56:47 PDT 2014


all this stuff sounds good...

> It’s in.  Note, however, that this extension does not (yet) work with list[x] := v.  Should it?   Somehow, having at()put() extend the list seems less bad than having []:= do it!

yes. I can't see any reason for []:= and at()put() being different

>  but there is as yet no automated way of testing coverage; that's on my list of things to do.

again: I'm not sure how much effort I'd spend on this now - i
but that's something to talk about with Tim & Kim 

the good thing about the collections is that they should "run" on any future implementation,
but it's not clear how long we will continue with minigrace (at least as the primary system).

> I wouldn’t put any into the _language_.  There would be a list.sort(comparisonBlock) in the list object.  Students could still write their own sorts (like Quicksort, and merge sort), but list.sort would be a magic “built-in-sort” that would be a lot faster, I hope, than any Grace code could ever be, because chunks would be “native”.

Hmm, if it's calling out to a comparison block it won't be that quick, will it? 
It will effectively depend on the FFI.      once jit, it shouldn't be "a lot" faster.

This does highlight another interesting question - since we're not aiming to be our own platform -
how much should be in our libraries vs the platform we're sitting on? 


What I'd like for sorting for purely selfish reasons are: 

compare(index) with(index)      (Or perhaps compareElementAt(index) with(index)

and

swap(index) with(index)        (Or ditton swapElementAt(index) with(index)

so I can e.g. easily extend or wrap a collection to count or visualise comparisons and swaps


James

>  
> 
>> Thanks for all of your hard work on this.  I really appreciate it.  (Could you let me know when you change at()put()?  I have code for the text that i want to try out.)
> 
> It should be working now.  Check that the browser says "minigrace-js v0.0.9.1997 / fda1808” after the Visibility pull-down.   I don’t know what the v0.0.9.1997 means, but the fda1808 is the git hash for the commit that the browser is running.
> 
> $ git log | head -20
> commit fda180857cfbe794cf5b4190f62470c38dba523a
> Author: Andrew P. Black <black at cs.pdx.edu>
> Date:   Tue Jul 29 18:10:23 2014 -0700
> 
>    Added more methods to collections.
> 
>    Included sequence methods and conversion methods.
>    Explanded the applicability of list.at(ix)put(v) to
>    case where ix = list.size + 1 (which was formerly a bounds
>    error.
>    Exported types in StandardPrelude, and corrected name to sequence.
> 
> commit 9b4322d7eb7bd23d2b8129995e99e482ab95137c
> Author: Andrew P. Black <black at cs.pdx.edu>
> Date:   Tue Jul 29 18:08:07 2014 -0700
> 
>    Web dependencies added to Makefile.
> ...
> 
> 
> 	Andrew
> 
> 
> 
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core
> 




More information about the Grace-core mailing list