[Cuis-dev] How can I add another collection syntax, such as {1} & #(1) & #[1]?

Juan Vuletich juan at cuis.st
Sat Aug 12 13:04:48 PDT 2023


On 8/12/2023 10:22 AM, Luciano Notarfrancesco via Cuis-dev wrote:
> I don’t know what an ETuple is, is is a kind of literal? I create 
> tuples (a kind of array) with the message #,. For example, (1,2,3) 
> sends ‘, 2’ to 1 and returns a tuple with 1 and 2, and then this tuple 
> receives ‘, 3’ and returns a tuple with 1, 2 and 3. It’s not the most 
> efficient way of creating tuples (it creates some temporary garbage), 
> and they are not literals, but it makes very readable code.

And you can turn any expression into a literal by enclosing it in 
backticks. These two generate the same CompiledMethod:

a
     ^`the answer to life the universe and everything`

b
     ^42

The only difference is that the first method will take quite a while to 
compile.

Cheers,

>
> On Sat, 12 Aug 2023 at 20:10 rabbit via Cuis-dev 
> <cuis-dev at lists.cuis.st <mailto:cuis-dev at lists.cuis.st>> wrote:
>
>     I think it will need to be such as read-only Array and ByteArray
>     construction, to differentiate from other selectors. So it will
>     need to be #<. I'm fine with it being a read-only ETuple, so that
>     it conforms to the convention of constructing read-ony objects ::
>     #() . and #[]. I could sent #makeWriteableObject to. If a Tuple
>     detects Computable, it could make itself Writeable, or when
>     computations occur prior to replacing the computable with the
>     result of computation. And so on and so forth. This would look as
>
>         #<#<1 !! 2 !! 3> !! #thisIsAConstructedWithNestingETuple>
>
>     Best,
>     ••• rabbit ❤️‍🔥🐰
>
>
>     On 8/12/23 09:03, rabbit via Cuis-dev wrote:
>>
>>     Good morning. I wish to add <> brackets to create an ETuple. How
>>     may I accomplish this? Such as:
>>
>>         <<1 !! 2 !! 3> !! #thisIsAConstructedWithNestingETuple>
>>
>>     Results in:
>>
>>         anETuple (2 elements :: {anETuple (3 elements :: {1 !! 2 !!
>>         3}) !! #thisIsAConstructedWithNestingETuple})
>>
>>     Gratefully,
>>     ••• rabbit ❤️‍🔥🐰
>>
>     -- 
>     ••• rabbit ❤️‍🔥🐰
>
>     -- 
>     Cuis-dev mailing list
>     Cuis-dev at lists.cuis.st <mailto:Cuis-dev at lists.cuis.st>
>     https://lists.cuis.st/mailman/listinfo/cuis-dev
>


-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230812/21eed97e/attachment.htm>


More information about the Cuis-dev mailing list