-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
2D arrays #276
Comments
@min-nguyen Realised that keeping lengthy discussions against commits isn’t very helpful, so created this task instead. |
Thanks! Also out of interest, is the need to introduce arrays due to wanting to implement matrix convolution? i.e. were there a way of performing convolution using only lists, would we not be interested in this? |
Yes, the main reason for arrays is simply that it’s a nicer fit for convolution and other similar applications. List^2 would be an alternative, although somewhat less type-constrained because there would be no requirement that the inner lists all be of the same size. I guess one thing we can do before we add arrays to the language is add list comprehensions - it sounds like we will need these for arrays, and it would be a nice feature to have anyway. So I suggest starting with We can then think about the evaluation semantics and slicing rules for list comprehensions, which would be a nice thing to have. (We’ll have to give a direct semantics for list comprehensions, rather than an indirect one expressed in terms of a translation to a core language. We can discuss why and what this would involve nearer the time.) |
Extracted a new task (#277) for list comprehensions, since they can be done first and will be an independently useful feature. |
A proposed syntax for arrays in Fluid, as a precursor to defining a formal syntax. Let’s start by rewriting the convolution example in “Fluid extended with array notation.” You can create a new file
fluid/example/convolution.fld
for this experiment. It won’t parse with our existing parser, but it will allow us to prototype how we want things to look before making changes to the grammar.Take a look at the code examples in the
fluid
folder to see what you can currently do in the language (unfortunately there isn’t any documentation yet, and there are some oddities like Unicode arrows). We can probably assume our arrays have a fixed lower bound (0 or 1). My guess is that this will take multiple iterations before we settle on a design, especially we’re not clear yet on the relationship to lists.If we’re going to end up needing comprehensions, you might like to take a look at https://www.haskell.org/onlinereport/exps.html#list-comprehensions for how Haskell translates list comprehensions into the core language.
add names to primitives– defer to later taskdependsNeither
(output dependencies only relevant to constructed values)eval_fwd
vs.desugarFwd
Done/dropped:
branch
andbranches
parsers into separate curried and uncurried versionsrange
toenumFromTo
, a la Haskellsetα
,getα
BinaryApp s1 op s2
intoApp (App (Op op) (desugar s1)) (desugar s2)
The text was updated successfully, but these errors were encountered: