"first" is doing more than expected #182
Replies: 5 comments 7 replies
-
Uhm... well, it behaves correctly: in this case the first item of a quotation is a symbol and it's not quoted, so when it's placed on the stack it is evaluated immediately... |
Beta Was this translation helpful? Give feedback.
-
Why does min need to auto-apply the symbol atop the stack? I'm a novice with stack programming languages, so I'm just starting to learn how these things are done myself. It seems that Joy does not have a problem with having bare symbols in the stack.
But you can't do much with them, other than use them to assemble lists/quotations. https://wodan58.github.io/j09imp.html
The operation "i" is what applies quotations:
But "i" cannot apply raw symbols
I see that you already have no problem having raw symbols on the stack: true and false
Though I also notice that mins apply works differently than joys "i" joy
min
|
Beta Was this translation helpful? Give feedback.
-
I was favoring Joy's way of allowing bare symbols to appear in the stack because that way I can ask if what's there is a symbol, a number, a string, or what. The thing is I wanted to recreate something I did in another language (Logo). This is what I tried to do: "tabla" receives a list of two lists and apply a quotation to each pair of their cartesian product. Think of it as a table which has the first list as row headers and the second list as column headers:
But the lists content can be symbols, so I can build a table of pieces of code:
which I can then run:
In min, I ran into problems when I tried to build the code for each cells because first behaves differently when what it extracts is a symbol, or a number. To tell you the truth, I haven't been able to port this to Joy either, yet. |
Beta Was this translation helpful? Give feedback.
-
I see, thanks. |
Beta Was this translation helpful? Give feedback.
-
Moved to fixed because the get-raw symbol was added, addressing the problem at least partially. |
Beta Was this translation helpful? Give feedback.
-
is there a way to get the first item of this quotation?
I was expecting the following to work, giving me 'a
Instead I get
Beta Was this translation helpful? Give feedback.
All reactions