LOGO-L> butfirst "a 
Author Message
 LOGO-L> butfirst "a

Can someone please explain this:

show map "bf [a b cc]
[  c]

show count map "bf [a b cc]
3

What is the content of the answer?

|| doesn't seem to be the empty word because:

show ||
not enough inputs to show

show bf "a

I'm confused.

Daniel
---------------------------------------------------------------





Tue, 01 Oct 2002 03:00:00 GMT  
 LOGO-L> butfirst "a

Quote:

> Can someone please explain this:

> show map "bf [a b cc]
> [  c]

> show count map "bf [a b cc]
> 3

> What is the content of the answer?

> || doesn't seem to be the empty word because:

> show ||
> not enough inputs to show

> show bf "a

> I'm confused.

> Daniel
> ---------------------------------------------------------------




As I understand it:
show map "bf [xa yb zc]  will give
[ a b c]
in your example
show map "bf [a b cc] will give
[ blank blank c]

which appears
[   c]

I would fascinated to know if there is a way to reduce [ blank blank c]
to [c] other than using an if routine.

---------------------------------------------------------------





Tue, 01 Oct 2002 03:00:00 GMT  
 LOGO-L> butfirst "a

Quote:

>show map "bf [a b cc]
>[  c]

    to delimit :word
    output (word "\| :word "\|)
    end

    ? show map [delimit bf ?] [a b cc]
    [|| || |c|]

Does that help?

Quote:
>show ||
>not enough inputs to show

Using vertical bars doesn't eliminate the need to quote words if you want
to use them as unevaluated data:

    ? show "||

    ?

For example, you can have a procedure named |My Procedure| if you want,
by saying

    to |My Procedure|
    output 5
    end

    ? show "|My Procedure|
    My Procedure
    ? show |My Procedure|
    5



Tue, 01 Oct 2002 03:00:00 GMT  
 LOGO-L> butfirst "a

Quote:
>Can someone please explain this:

>show map "bf [a b cc]
>[  c]

>show count map "bf [a b cc]
>3

>What is the content of the answer?

>|| doesn't seem to be the empty word because:

>show ||
>not enough inputs to show

>show bf "a

>I'm confused.

Daniel,

Your first assumption is correct.
The result bf "a is an empty word in the same way as the result of bf [a]
is an empty list.

You made a mistake when trying to print an empty word.
You have to say:
show "||

or just

show "

a double quote followed by nothing denotes the empty word.
You have to use the two bars with nothing inside only in special
situations, for example if you want to have a list, which element is an
empty word.

Studying the following lines may give you also some more information (or
maybe new questions) connected with the idea of empty word and empty list:

show " = bf "a
true
show " = bf [a]
false
show [] = bf [a]
true
show " = first [|| || a]
true
show word? "
true
show empty? "
true
show empty? []
true

Regards

Peter Tomcsanyi

---------------------------------------------------------------





Wed, 02 Oct 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. LOGO-L> copydef "fin "end

2. "ls" of only hidden files

3. Enhancing "ls -l" file listing abilities

4. couldn't execute "ls": argument list too long

5. Read "ls" output into list variable

6. exec "ls" in remote directory

7. Logo for MS-DOS ("rich logos")

8. LOGO-L> Apple logo/MSW Logo

9. LOGO-L> Reseach Machines Logo (RM LOGO)

10. exec ls -l vs. exec "ls -l"

11. WTD: 'ls -lR '->HTML code

12. print "hello", >> file

 

 
Powered by phpBB® Forum Software