Jump to content

Recommended Posts

25 minutes ago, Kaj de Vos said:

Those are advanced features. I use them only to accomplish specific goals for Meta. I will certainly not offer all those options for Meta. Usually, they can be much simplified when you take a step back and consider what it is that you want to accomplish.

I agree, it's nothing that needs to be done early in the language development. I listed the cases just a reminded what everything may be needed to cover in the future - may be useful when designing the low-level part of the language addressing the 8bit Atari needs. Often these needs cannot be simplified because of how the old hardware or OSes are designed.

Link to comment
Share on other sites

@Kaj de Vos - do you have already arrays/series implemented in Meta? If not, how do you plan to approach this topic? Are they going to be dynamic/expandable like in REBOL or fixed size? From REBOL documentation:

REBOL uses the concept of expandable SERIES for holding and manipulating data, rather than the concept of fixed size arrays. For example, in REBOL you would normally write:

    block: copy []
    repeat n 5 [append block n]

rather than:

    block: array 5
    repeat n 5 [poke block n n]

In other words, REBOL does not require you to specify the size of data arrays (blocks, bytes, or strings) in advance. They are dynamic.

I have tried to compile following - are they already implemented?

    flags: array size - Script error: "array" has no value
    flags: copy [] - Script error: "copy" does not work on parameter type: expressions list block!

Link to comment
Share on other sites

13 minutes ago, ilmenit said:

Script error: "WORD" has no value

means that WORD is undefined. So, not implemented.

14 minutes ago, ilmenit said:

Script error: "METHOD" does not work on parameter type

means that METHOD is defined, but on other parameter types than you gave it.

16 minutes ago, ilmenit said:

do you have already arrays/series implemented in Meta? If not, how do you plan to approach this topic? Are they going to be dynamic/expandable like in REBOL or fixed size?

Both, but expandable is a dynamic feature, so that will come later:

https://language.metaproject.frl/#state

The current support is quite close to REBOL, but static, and only byte arrays and simple strings so far:

array= make static binary! 10

 

Link to comment
Share on other sites

17 minutes ago, Kaj de Vos said:

The current support is quite close to REBOL, but static, and only byte arrays and simple strings so far:


array= make static binary! 10

 

Thanks, how to make an memset of the array? Neither change nor head, forall seem to be implemented yet (no value) - is there some implemented way of setting an array value? Trying something like this:

    sizepl: 8192
    flags:  make static binary! sizepl
    for i sizepl
    [
        change at flags i 1
    ]
    flags: head flags

EDIT: ok, poke seems to work, will return with more testing ;-)

Edited by ilmenit
Link to comment
Share on other sites

2 minutes ago, Kaj de Vos said:

Meta has let-word!s for constants in addition to set-word!s, so to define the array as static, you need:

sizepl=

flags=

 

change at is very inefficient at that, that would be poke.

 

head is at-head in Meta.

thanks, what about pick? Not implemented yet? I also tried at-pick and pick-at.

Link to comment
Share on other sites

3 minutes ago, Kaj de Vos said:

What does the compiler tell you?

Script error: "pick" does not work on types combination

Here is the code I'm trying to compile:

iter: 1
sizepl: 8192 ; becase with "sizepl= 8192" this "for i sizepl" does not compile
size= 8190

while [ iter <= 10 ] 
[
    count: 0
	i: 0
	flags= make static binary! sizepl
	for i sizepl
    [
        poke flags i 1
    ]
    flags: at-head flags

    while [ i <= size ]
    [
        p: pick flags i
        if p = 1 
        [
		    prime: (i*2) + 3
            k: i + prime
            while [ k <= size ] 
            [
                poke flags k 0
                k: k + prime
            ]
			count: count + 1
        ]
		i: i + 1
    ]
    iter: iter + 1
]

 

Link to comment
Share on other sites

3 hours ago, Kaj de Vos said:

So pick is implemented, but you left out what type combination it doesn't support.

it doesn't work neither for flags= make static binary! sizepl nor flags: make static binary! sizepl

** Script error: "pick" does not work on types combination:
Parameter types:
1: static-binary! [flags i
    if p = 1
...
2: integer! [i
    if p = 1
    [
...
At: [pick flags i
    if p = 1
    [
        prime: (i*2) + 3...
In: [
    p: pick flags i
    if p = 1
    [
        prime: (...
Near: [
    while [i <= size]
    [
        p: pick flags i
   ...

also when I set:

sizepl= 8192

then

** Script error: "for" does not work on types combination:
Parameter types:
1: integer! reference [i sizepl
    [
      ...
2: natural16! [sizepl
    [
        ...
3: literal block! [
    [
        poke f...
At: [
    for i sizepl
    [
        poke flags i 1
    ]
   ...
In: [
    count: 0
    i: 0
    flags= make static binary! si...
Near: [
    while [iter <= 10]
    [
        count: 0
        i...

 

  • Thanks 1
Link to comment
Share on other sites

4 minutes ago, Kaj de Vos said:

I deployed a new compiler to the server. Should be implemented now.

Thanks, I'm getting closer to the end of compilation issues. Now for the code:

iter: 1
sizepl= 8192
size= 8190

while [ iter <= 10 ] 
[
    count: 0
    i: 0
    flags= make static binary! sizepl
    for i sizepl
    [
        poke flags i 1
    ]
    flags: at-head flags

    i: 0
    while [ i <= size ]
    [
        p: pick flags i
        if p = 1 
        [
            prime: ( i * 2 ) + 3
            k: i + prime
            while [ k <= size ] 
            [
                poke flags k 0
                k: k + prime
            ]
            count: count + 1
        ]
        i: i + 1
    ]
    iter: iter + 1
]

I receive the following output and error:

code: [none while
    [/block! compile/block
        [logic! is-lesser-or-equal
            [integer! compile/value [global! k]]
            [natural16! compile/value [global! size]]
        ]
    ]
    [/block! compile/block
        [byte! poke
            [/static-binary! compile/reference [global! flags]]
            [integer! compile/value [global! k]]
            [byte! 0]
        ]
        [integer16! set
            [:integer! compile/reference [global! k]]
            [integer16! add
                [integer! compile/value [global! k]]
                [integer! compile/value [global! prime]]
            ]
        ]
    ]
]
** Script error: "while" does not work on types combination:
Parameter types:
1: expressions list block! [[k <= size]
    [
   ...
2: expressions list block! [
    [
        poke f...
At: [
    while [k <= size]
    [
        poke flags k 0
    ...
In: [
    prime: (i * 2) + 3
    k: i + prime
    while [k <=...
Near: [
    if p = 1
    [
        prime: (i * 2) + 3
        k...

 

Link to comment
Share on other sites

Ok, removed the block from the while but now again I'm getting the error in for:

 

iter: 1
sizepl= 8192
size= 8190

while iter <= 10 
[
    count: 0
    i: 0
    flags= make static binary! sizepl
    for i sizepl
    [
        poke flags i 1
    ]
    flags: at-head flags

    i: 0
    while i <= size
    [
        p: pick flags i
        if p = 1 
        [
            prime: ( i * 2 ) + 3
            k: prime + i 
            while k <= size
            [
                poke flags k 0
                k: k + prime
            ]
            count: count + 1
        ]
        i: i + 1
    ]
    iter: iter + 1
]

error:

** Script error: method "for" does not work on types combination:
Return value not used.
Parameter types:
1: integer! reference [i sizepl
    [
      ...
2: natural16! [sizepl
    [
        ...
3: statements sequence block! [
    [
        poke f...
At: [
    for i sizepl
    [
        poke flags i 1
    ]
   ...
In: [
    count: 0
    i: 0
    flags= make static binary! si...
Near: [
    while iter <= 10
    [
        count: 0
        i: ...
Link to comment
Share on other sites

19 minutes ago, Kaj de Vos said:

One step closer: on the back-end instead of the front-end. Updated again.

thanks, now there is another error in the same code:

** Script error: no known implicit method "is-equal" with 2 parameters.
At: [= 1
    [
        prime: (i * 2) + 3
        k: prime + ...
In: [p = 1
    [
        prime: (i * 2) + 3
        k: prime ...
Near: [
    if p = 1
    [
        prime: (i * 2) + 3
        k...

  • Thanks 1
Link to comment
Share on other sites

1 minute ago, Kaj de Vos said:

Ah, changed that to EQUALS. You can use that as workaround (prefix). Laptop is empty now, more fixes tomorrow.

If I understand properly what do you mean by (prefix) I got the following error:

 

** Script error: no known implicit method "is-equal" with 2 parameters.
At: [EQUALS p 1
    [
        prime: (i * 2) + 3
        k: p...
In: [
    if EQUALS p 1
    [
        prime: (i * 2) + 3
    ...
Near: [
    p: pick flags i
    if EQUALS p 1
    [
        pri...

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...