1. how does value() return an atom??

v = value(x)

value(x) is supposed to return a sequence, right?
So how is this error possible?
"type_check failure, v is 7"

new topic     » topic index » view message » categorize

2. Re: how does value() return an atom??

Actually value() always returns a sequence. [http://openeuphoria.org/docs/std_get.html#_2214_value]

new topic     » goto parent     » topic index » view message » categorize

3. Re: how does value() return an atom??

I think that's what Jerry's trying to say - he's expecting a sequence but getting an atom.

Do you have a larger example?

new topic     » goto parent     » topic index » view message » categorize

4. Re: how does value() return an atom??

jaygade said...

Do you have a larger example?

global function my_value(object x)  -- substitute for Euphoria's value() 
atom a 
sequence v 
 
  if atom(x) then 
    a = 0 
  else 
    v = value(x) 
    if v[1] = GET_SUCCESS then 
      a = v[2] 
    else 
      a = 0 
    end if 
  end if 
  return(a) 
end function    -- my_value() 

The above code always worked before. Now I'm getting this error message:

"type_check failure, v is 7"

It makes no sense to me. How is this possible?

new topic     » goto parent     » topic index » view message » categorize

5. Re: how does value() return an atom??

Jerry_Story said...
v = value(x)

value(x) is supposed to return a sequence, right?
So how is this error possible?
"type_check failure, v is 7"

For what value of x does value() return a 7?

new topic     » goto parent     » topic index » view message » categorize

6. Re: how does value() return an atom??

DerekParnell said...
Jerry_Story said...
v = value(x)

value(x) is supposed to return a sequence, right?
So how is this error possible?
"type_check failure, v is 7"

For what value of x does value() return a 7?

puts(1, "hello ... " & x & "\n")
prints:
hello ... 7

new topic     » goto parent     » topic index » view message » categorize

7. Re: how does value() return an atom??

Jerry_Story said...
DerekParnell said...
Jerry_Story said...
v = value(x)

value(x) is supposed to return a sequence, right?
So how is this error possible?
"type_check failure, v is 7"

For what value of x does value() return a 7?

puts(1, "hello ... " & x & "\n")
prints:
hello ... 7

Sorry to be picky but are you saying that value("7") returns an atom/integer of 7?

new topic     » goto parent     » topic index » view message » categorize

8. Re: how does value() return an atom??

DerekParnell said...

Sorry to be picky but are you saying that value("7") returns an atom/integer of 7?

Yup. But it's supposed to return a sequence.

new topic     » goto parent     » topic index » view message » categorize

9. Re: how does value() return an atom??

Jerry_Story said...
DerekParnell said...

Sorry to be picky but are you saying that value("7") returns an atom/integer of 7?

Yup. But it's supposed to return a sequence.

I know its supposed to return a sequence.

Here is what I get ...

c:\temp>type bug.ex 
include std/get.e 
? value("7") 
 
c:\temp>eui bug 
{0,7} 
 
c:\temp> 
Which seems to saying that its working as expected.

Could it be that you are actually running a different value() function rather than the one in the standard library?

new topic     » goto parent     » topic index » view message » categorize

10. Re: how does value() return an atom??

DerekParnell said...

Could it be that you are actually running a different value() function rather than the one in the standard library?

Yup that was it. I changed the code as follows:

include std/get.e as stdget  -- include std/get.e 
-- 
-- 
    v = stdget:value(x)  -- v = value(x) 

And then the problem vanished.

I found this in Irv's GtkEngine.e.

override function value(object x) -- replacement for Eu's value() 

Could that cause the problem? It didn't before.

new topic     » goto parent     » topic index » view message » categorize

11. Re: how does value() return an atom??

Jerry_Story said...

Could that cause the problem? It didn't before.

Before what?

new topic     » goto parent     » topic index » view message » categorize

12. Re: how does value() return an atom??

DerekParnell said...
Jerry_Story said...

Could that cause the problem? It didn't before.

Before what?

The previous time I ran the program. The date on it is November 15, 2010.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu