Talk:Ivy: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (→‎Features - recursion: .. finish fix, prevent one last error category)
(Notes on nesting as of v0.3)
 
Line 2: Line 2:


I've marked Ivy as flat, because it's clearly not intended for computation on nested arrays. The examples and tests only ever show flat arrays, and nested arrays, when created, are often not formatted correctly. However, it's possible to create a nested array with an expression such as <code>,\ iota 4</code> or <code>"abc" o., "de"</code>. I think this is because the implementation has dedicated types for numbers and characters, but these aren't kept separate from the array types vector (rank 1) and matrix (arbitrary rank). So more accurately the current implementation of Ivy might be considered a [[based array model|based]] or [[nested array model|nested]] language that opens scalars (including non-simple ones) whenever they show up. That's confusing and probably not really the creator's intent, so I'm only mentioning it here. [[User:Marshall|Marshall]] ([[User talk:Marshall|talk]]) 19:50, 5 February 2021 (UTC)
I've marked Ivy as flat, because it's clearly not intended for computation on nested arrays. The examples and tests only ever show flat arrays, and nested arrays, when created, are often not formatted correctly. However, it's possible to create a nested array with an expression such as <code>,\ iota 4</code> or <code>"abc" o., "de"</code>. I think this is because the implementation has dedicated types for numbers and characters, but these aren't kept separate from the array types vector (rank 1) and matrix (arbitrary rank). So more accurately the current implementation of Ivy might be considered a [[based array model|based]] or [[nested array model|nested]] language that opens scalars (including non-simple ones) whenever they show up. That's confusing and probably not really the creator's intent, so I'm only mentioning it here. [[User:Marshall|Marshall]] ([[User talk:Marshall|talk]]) 19:50, 5 February 2021 (UTC)
:Official support for nesting was added in [https://github.com/robpike/ivy/commit/a0c08b0577677d34fa45b66cc1df5a62f480e124 this commit], which also confirms that the ability to create nested arrays before was unintentional. As of v0.3.1 it seems to be impossible to create scalar arrays, as the few functions that would do this either open the result (reduce, selection) or otherwise avoid rank 0 (dyadic <code>rho</code> treats an empty left argument as 0). Which I think means it could equally be described as nested without non-simple scalars, or based without scalar arrays. --[[User:Marshall|Marshall]] ([[User talk:Marshall|talk]]) 20:57, 15 August 2023 (UTC)


== Features - recursion ==
== Features - recursion ==

Latest revision as of 20:57, 15 August 2023

Array model

I've marked Ivy as flat, because it's clearly not intended for computation on nested arrays. The examples and tests only ever show flat arrays, and nested arrays, when created, are often not formatted correctly. However, it's possible to create a nested array with an expression such as ,\ iota 4 or "abc" o., "de". I think this is because the implementation has dedicated types for numbers and characters, but these aren't kept separate from the array types vector (rank 1) and matrix (arbitrary rank). So more accurately the current implementation of Ivy might be considered a based or nested language that opens scalars (including non-simple ones) whenever they show up. That's confusing and probably not really the creator's intent, so I'm only mentioning it here. Marshall (talk) 19:50, 5 February 2021 (UTC)

Official support for nesting was added in this commit, which also confirms that the ability to create nested arrays before was unintentional. As of v0.3.1 it seems to be impossible to create scalar arrays, as the few functions that would do this either open the result (reduce, selection) or otherwise avoid rank 0 (dyadic rho treats an empty left argument as 0). Which I think means it could equally be described as nested without non-simple scalars, or based without scalar arrays. --Marshall (talk) 20:57, 15 August 2023 (UTC)

Features - recursion

Not sure it can be said that ivy has no recursion.

op fact x = x<=1: 1; x*fact(x-1)

fact 5
120

Regards, —Mykhal (talk) 12:40, 16 December 2022 (UTC)