BornAgainAtheist wrote:
Until then, Brian & Jens, would you distribute it if I made a Snap copy of all the functions from BYOB's tool sprite? I'd like to help somehow and unless you need a Python coder or very very green JS coder for something, I don't think I could be any help in the actual coding.
Sure. As long as you write the list higher order functions using IN FRONT OF (cons) and ALL BUT FIRST ITEM OF (cdr) rather than the imperative-style implementations in the BYOB toolkit. (Had to be that way in BYOB for efficiency reasons but now efficiency as well as aesthetics requires cons/car/cdr linked list style.
Thanks.
Offline
Hardmath123 wrote:
Please add these [string operations], they're really helpful:
I agree that we should add the ability to handle text soon. But I'd like to raise the idea that we should do it Logo-style (words and sentences) rather than Scratch-style (flat strings of text). Argument for the change: It's a much more natural way to handle natural language text. When you're reading "the quick brown fox" you don't see a string of 19 characters; you see a sequence of four words. You don't really see the spaces between words at all, unless you're writing a text-string-based computer program.
Argument against: The functions I want can be written in terms of the Scratch ones, and the latter are at a lower level of abstraction, so writing the former is a good learning opportunity -- the same reason MAP, KEEP, etc. aren't primitives.
At the very least, though, we should make JOIN variadic.
Offline
bharvey wrote:
Hardmath123 wrote:
Please add these [string operations], they're really helpful:
I agree that we should add the ability to handle text soon. But I'd like to raise the idea that we should do it Logo-style (words and sentences) rather than Scratch-style (flat strings of text). Argument for the change: It's a much more natural way to handle natural language text. When you're reading "the quick brown fox" you don't see a string of 19 characters; you see a sequence of four words. You don't really see the spaces between words at all, unless you're writing a text-string-based computer program.
Argument against: The functions I want can be written in terms of the Scratch ones, and the latter are at a lower level of abstraction, so writing the former is a good learning opportunity -- the same reason MAP, KEEP, etc. aren't primitives.
At the very least, though, we should make JOIN variadic.
What does variadic mean?
EDIT: Got it—arbitrary number of inputs. I was wondering about what to call that for ages!
Last edited by Hardmath123 (2012-03-03 08:38:01)
Offline
Hardmath123 wrote:
I was wondering about what to call that for ages!
CLONE: niladic
SQRT: monadic
MOD: dyadic
LIST: variadic
P.S. And the name for "the number of inputs this block expects" is its arity (yes, no "p" at the front).
Last edited by bharvey (2012-03-03 09:45:48)
Offline
bharvey wrote:
Hardmath123 wrote:
I was wondering about what to call that for ages!
CLONE: niladic
SQRT: monadic
MOD: dyadic
LIST: variadic
P.S. And the name for "the number of inputs this block expects" is its arity (yes, no "p" at the front).
Now I'm curious: how do you express a variatic function in, say, JavaScript? You can probably manage in BYOB with "multiple input"...
Offline
Hardmath123 wrote:
how do you express a variatic function in, say, JavaScript?
Offline
in the byobs repeat function that has an out var for the cycle, the cycle starts at one is it fine if it starts at zero?
Offline
@ bharvey & Jens
bharvey says "The other is that all the grey borders disappear. (Maybe we're doing away with grey borders, in which case we should do away with them soon!"
Grey bordering does not work in the Script Area, but works well into the block editor.
In the first case there is a walk around , use THE...BLOCK. The issue is that one instruction with "grey borders" is much shorter than with "the block" with cases where you need to chain many of such instructions.
Offline
@ bharvey & Jens
I'm reverting to this issue : if you want to use a named variable as a list, you need to first initiate it to a void list (LIST()). IMHO this prevents to write MAP-like functions in a pure recursive style (with the help of ALL BUT FIRST) as it can be seen in the Byob Reference Manuel p14
Offline
BornAgainAtheist wrote:
in the byobs repeat function that has an out var for the cycle, the cycle starts at one is it fine if it starts at zero?
I know that would feel more computer sciency, but it doesn't mesh well with the fact that list elements are numbered from 1. And, for non computer scientists, it would feel unnatural, I think. When you ask "which repetition is this?" you don't mean "how many repetitions were already completed before this one started?" Starting from 1 means that the cardinality and ordinality match up -- that is, even if you want to call this repetition number 0, you're still going to say it's the first repetition.
P.S. I am burning with curiosity, but feel free to ignore this if you want: Are you ethnically Chinese? Here at Berkeley it's always the Chinese(-American) students who say "is it fine?" rather than "is it okay?"
Offline
bharvey wrote:
P.S. I am burning with curiosity, but feel free to ignore this if you want: Are you ethnically Chinese? Here at Berkeley it's always the Chinese(-American) students who say "is it fine?" rather than "is it okay?"
No, but I am 1/64 American Indian, I'm mostly Norwegian. My family has been in America for the whole century at least so there isn't much cultural influence on my speech or word choice, it just varies from sentence to sentence. If that was grammatically incorrect, I'm sorry... can't fix it until I have more posts on my new profile and I was never as up on grammar in school as math and technology (unless its programming 'grammar')
Offline
bharvey wrote:
xly wrote:
this prevents to write MAP-like functions in a pure recursive style (with the help of ALL BUT FIRST)
Eh?
http://cs.berkeley.edu/~bh/xly.png
What am I missing?
Excellent ! You' ll have to change accordingly your MAP example into your Byob tutorial !!!
Offline
xly wrote:
Your MAPG is having trouble deciding whether it wants to be a command (base case) or a reporter (recursive case). If it REPORTs most of the time, it has to REPORT in the base case, too!
Offline
@Jens & bharvey
Up to now, I was using Firefox 10 + Windows XP. I could not correctly Save/Load any Snap! applications. I've switched to Chrome, and then "miracle !" now any of my (simple) applications can be Saved/Loaded with no problem, even after Closing/Re-Opening Chrome !Please find an example of these :
Offline
we need call/run with input list.
Also, i have an idea:
If you drag a reporter that reports a list onto the left/right arrows of a variadic input slot, it should evaluate the list as the inputs it takes.
Offline
joefarebrother wrote:
If you drag a reporter that reports a list onto the left/right arrows of a variadic input slot, it should evaluate the list as the inputs it takes.
Oh, that is a cool idea! Then we wouldn't need a special case for call and run. Jens? What do you think?
Edit: It'd have to accept any reporter, since in general we can't predict what type a reporter will report. It's worth noting, although I don't think this rules out the idea, that that introduces another source of runtime errors (ones not prevented by not letting you drop a block where it doesn't belong). More problematic is that it would totally not be obvious what it means to drop something over the arrows. It might (sigh) have to be a preferences-enabled capability.
Last edited by bharvey (2012-03-04 23:22:33)
Offline
bharvey wrote:
joefarebrother wrote:
If you drag a reporter that reports a list onto the left/right arrows of a variadic input slot, it should evaluate the list as the inputs it takes.
Oh, that is a cool idea! Then we wouldn't need a special case for call and run. Jens? What do you think?
Ummm..., well..., you know that's exactly what my first version did,and I still believe it's the right thing, but you didn't like it so I disabled it. The good thing is that I only need to take out a single line of code to re-enable this feature
But you're right, and now I remember that's the reason why, in fact, both of us wound up not liking it, that this also removes the variadic slot's label which makes the resulting block non-obvious to understand. And that's why we decided to turn the "... WITH INPUT LIST" variations into separate blocks. But if we come up with a better, more concise solution, I'm perfectly willing to reconsider.
Offline
bharvey wrote:
BornAgainAtheist wrote:
I get extremely defensive of python, I love python
Python's okay, except for the whitespace thing and except for using = to mean assignment. But what big idea does it add that's different from, say, Javascript or Objective C? Or, maybe I should just say, what do you like about it?
(Don't say "import antigravity.")
I literally just found that comic.
Offline
xly wrote:
Chrome has a "Save page" feature which provides one *.htm page where one can read the internal coding of the current Snap! application, It seems promising !
So does any modern browser, I think. FF for sure.
Offline