« first day (534 days earlier)      last day (1277 days later) » 

21:59
Doorknob has unfrozen this room.
Ó                   " Substitute...
 .                  "   Any character
  /                 " with
   &                "   That character, followed by
    GA*<C-v><esc>   "   "GA*<esc>"
D                   " Delete the line we just substituted on
 8ï                 " Make 8 new empty lines
   Î                " On every line...
    i               "   Insert...
     Û              "     <current-line>
      :             "     ':'
@                   " Run the text we deleted as V code
@cairdcoinheringaahing This is a particularly hard to understand example because it half of it is building V code that does what we want, and the other half is running it
FWIW, <n>G moves the cursor to line #N, and A enters insert mode at the very end of the current line
One advantage V has over Jelly: I can type the characters on my phone :P
Here you can see the command the first line builds
@cairdcoinheringaahing If you don't mind me asking, what is your time zone?
@DrMcMoylex GMT
(I think. I'm in England)
So it's 10 for you?
22:08
@DrMcMoylex Just gone, yeah
That's unfortunate. The best time for me to give you a V lesson would be in the middle of the night for you.
I'm not sure what your sleep schedule is like :shrug:
@DrMcMoylex Give me a bit of time to get the basics of vim/V and I'll be able to use TIO rather than actual vim. I can try to teach myself the beginning.
Also, for the Motions subsection in the wiki, are they vim or V commands?
Mostly vim, but a few are V
Pretty much anything non-ASCII is V
Oh wait
I thought you were talking about the tutorial
@cairdcoinheringaahing Anything under commands is listing only V specific features
@cairdcoinheringaahing BTW, Here is the exact same program written in verbose mode. (check the debug output too)
@DrMcMoylex I am
Let me clarify
22:16
I just realised how good V can be in string golfs :P
Most of these are vim. Anything not in vim will be marked V-specific. All of these are V-specific
@DrMcMoylex Ah, that makes sense
This may be a stupid question, but how can you add two numbers in V?
Hahaha
It's much harder than it should be lol
And do you take input as numbers, or byte codes?
@cairdcoinheringaahing Basically, you need to get num1 into a certain register by deleting/yanking it. Then you do @<register> to run it as V code. Then, you'll do <C-a> which means (increment the next number after the cursor n times), which right after @<register> will be equivalent to num1<C-a>
@cairdcoinheringaahing Numbers
You can do it in two bytes if you take input in the right format: Try it online!
22:21
@DrMcMoylex Don't give the program, I'll try (and fail) to do it that way :P
Damn slow internet. I'm not going to look though
If you say so.
Do you know how to run specific registers?
@DrMcMoylex Does typing <C-a> with the -v flag do the same thing as the literal character?
Yes. Which is needed because the literal character is unprintable 0x01
Is "repeat next command n times" ä?
No
That is the duplicate command (<M-d>). It makes n copies of motion
@cairdcoinheringaahing You can just do <n><command>
22:28
@DrMcMoylex What if n is in the buffer?
@cairdcoinheringaahing Then you need to delete it into a specific register, then do @<reg><command>
If it's just one digit, you can do x. If it's at the end of the line, I'd recommend D. Otherwise, diw is a safe bet, just less golfy
Oh yeah, BTW, to delete into register 'a' (for example) you want to do "ad<motion>, or "ax. If you don't specify a register, it'll always go to register " (double quote)
So to delete a line of input into a, you'd do "ad$?
So why is a line feed required after $ in this?
But two notes: 1) D is literally exactly the same as d$, so that can save one byte. 2) It doesn't delete an entire line. Note the differences here and here
22:34
@DrMcMoylex So does the second d remove the leading line feed?
@cairdcoinheringaahing d$ leaves an empty line. Strangely enough, line-feed is a motion for go to the next line
@cairdcoinheringaahing Almost. It removes the line-feed at the end of line 1
I wish V on TIO could modify the bytecount displayed if the -v flag was used. I actually have to count the bytes
And I have 7 bytes for adding the inputs
Yeah. I've asked Dennis about something similar for brain-flak
@cairdcoinheringaahing nice! Can I see?
@DrMcMoylex Hold on, TIO hates me. My code was:
"aD\n@a<C-a>
No multi line on mobile
Nice!
Some tips...
If you don't give a register argument, it'll delete into register ", so you could save 2 by doing D\n@"<C-a>
And also, you can do J to get rid of extra of the leading newline (doesn't save any bytes, it's just nicer output and more idiomatic approach)
You could also do j to move down instead of line-feed, which is much more idiomatic
22:40
Ooh, that's helpful
Crap, my parents turned off the internet, I have to go. o/ and thanks for the lesson!
No problem! Glad to help :)
BTW, if you do try learning vim, I highly highly highly recommend vimtutor
It comes with vim by default, and it's a ~20~ minute interactive tutorial on how to use vim
I'll check it out, thanks

« first day (534 days earlier)      last day (1277 days later) »