As someone currently attempting to learn Zig (first low level language), content like this where you code and respond to compiler error messages is so helpful!
In Nim: import strutils for line in lines "temps.txt": try: echo( if line[^1] == 'F': $((line[0..line.high-2].parseFloat-32)*5.0/9.0).formatFloat(ffDecimal,1)&" F" else: line ) except:discard
But awk is written in C, which is not memory safe … so it could randomly segfault at any moment, wipe out your hard drive, knock over your chair, and set fire to the bookshelf all at the same time. Scary AF !
That's not true a memory fault will never lead to a harddrive wipe and I mean after 40 years it is robust. Besides it's rather trivial to do memory safe because it's a stram processor.
@@CallousCoder sorry mate .. was having an oblique dig at the more fearful types out there who say you can only use rust, because anything else might randomly segfault:)
@@steveoc64 😀😁🤣yeah the Rust clan is almost an organized religion 😅 It’s ironic isn’t it… they do get into cars, trains, aeroplanes and they are full of C code 😀
Oh really? I haven’t noticed it when I was there. The only think I noticed was the idiotic low speed limit of 110K through the mind numbingly empty prairies of Saskatchewan and having the funds to have a copper posting every 10KM to enforce that limit 🤣
@@CallousCoder it's mostly by the people and more predominant the closer you get to the border. when talking about height, inobody says centimeters, it's always feet and inches. weight, we use lbs. nobody knows how many kg they weigh or lift. temperature? it's 50/50 between Celsius and Fahrenheit . food recipes? all imperial.
Well font size in kitty is not dynamic and the font is otherwise too small. And I also need to setup neovim on this new system still :D I should also lookup the keyboard shortcuts in VSCode as most customers use that crap ;)
@@CallousCoder I'm actually more interested in embedded zig. I'm trying to do an arduino project with led lights. Zig on an arduino uno would be my video request. I got the test light blinking yesterday. Need to figure out the led part now. Might try to use predefined c funcs. From arduino libs.
@@judsenhembree7697 I actually have 4 videos on zig for pi pico on here making the Simon game. The ATMel is minimally supported by the embedded zig and I read they canceled further development. But I assume digital ports will work, it’s the easiest to do, even without a HAL (hardware abstraction layer) it is pretty straightforward. I understand why they aren’t too thrilled to continue on atmel it being an 8 bit micro controller that are more expensive than 32 bit arm cortex.
@@CallousCoder Having MS and not being able to feel my fingertips I can relate to typing mostly random chars all-day 🙂 But, I didn't mean 'write the program in Vim' I meant 'do it in Vim'. Pattern match, macro, etc.
@@ViaConDias oh man MS! I’m sorry. Must be so frustrating when your body doesn’t want to keep up anymore. I’ve had a neck hernia 15 years ago and I lost control over my right arm for sometime and my thumb still feels a bit numb. I could even unscrew something for a few weeks or do card magic or play guitar. I was so frustrated. Luckily that all came back in my case. But I was seriously worried so I can only imagine what you go through. Always wondering/worrying if it progresses. Brrrr I really feel for you. Hope it just stabilizes. And I think you should be able to do it all in vim. I actually never calculated something in vim but you can call bc of course. Hmmmm I feel a challenge 🤣
@@CallousCoder Sorry to hear that. I was paralyzed in the right side of my body for 3 years and the doctors told me I had 1 - 2 years left. That was 16 years ago and today you wouldn't be able to see that I am sick. I am close to the best shape of my life and I have a great life. Took me 10 years in the gym but hey, life is life, and if your mother ever told you it was going to be easy she was lying. If you keep pushing forward every day then no matter the outcome, at least you know you did what you could and you can't really ask more from yourself. I don't know what OS you are on but in Linux you would have 'calc' available to you. But a simple script that takes the number as an input and only does the actual calculations would do it too. Python or Zig, doesn't matter much. Hope you take it on and post a follow-up video.
He means it hyperbolically. It takes longer to write a program in a general purpose language for sure -- especially when you use awk frequently. In my case I would probably spend as much time getting it done in awk :D His video is btw really good.
As someone currently attempting to learn Zig (first low level language), content like this where you code and respond to compiler error messages is so helpful!
Thank you, I am glad it's helpful for you!
In Nim:
import strutils
for line in lines "temps.txt":
try:
echo(
if line[^1] == 'F':
$((line[0..line.high-2].parseFloat-32)*5.0/9.0).formatFloat(ffDecimal,1)&" F"
else: line
)
except:discard
In vi one line ( the next video 🤣)
@@CallousCoder Can't wait to see it 🙂
@@megetmorsomt it’s online 😉
@@CallousCoder 🤣🤣
Or you could write it in 5 minutes in Python.
Or do it in vim in less than a minute. The next video 😉
But I would probably have don’t if in Python. And I loathe Python ☺️
But awk is written in C, which is not memory safe … so it could randomly segfault at any moment, wipe out your hard drive, knock over your chair, and set fire to the bookshelf all at the same time.
Scary AF !
That's not true a memory fault will never lead to a harddrive wipe and I mean after 40 years it is robust. Besides it's rather trivial to do memory safe because it's a stram processor.
@@CallousCoder sorry mate .. was having an oblique dig at the more fearful types out there who say you can only use rust, because anything else might randomly segfault:)
@@steveoc64 😀😁🤣yeah the Rust clan is almost an organized religion 😅
It’s ironic isn’t it… they do get into cars, trains, aeroplanes and they are full of C code 😀
canada can't make up mind either. we have a mind boggling mix of both metric and US-imperial systems.
Oh really? I haven’t noticed it when I was there.
The only think I noticed was the idiotic low speed limit of 110K through the mind numbingly empty prairies of Saskatchewan and having the funds to have a copper posting every 10KM to enforce that limit 🤣
@@CallousCoder it's mostly by the people and more predominant the closer you get to the border.
when talking about height, inobody says centimeters, it's always feet and inches.
weight, we use lbs. nobody knows how many kg they weigh or lift.
temperature? it's 50/50 between Celsius and Fahrenheit .
food recipes? all imperial.
Why force vscode into your vids? Just use vim. Lol.
Sounds like you use vim usually.
Good vid btw
Well font size in kitty is not dynamic and the font is otherwise too small.
And I also need to setup neovim on this new system still :D I should also lookup the keyboard shortcuts in VSCode as most customers use that crap ;)
@@judsenhembree7697Thanks for watching and the compliment. Happy you like it. It seems many people like the smaller easy to do program videos.
@@CallousCoder I'm actually more interested in embedded zig. I'm trying to do an arduino project with led lights.
Zig on an arduino uno would be my video request.
I got the test light blinking yesterday. Need to figure out the led part now.
Might try to use predefined c funcs. From arduino libs.
@@judsenhembree7697 I actually have 4 videos on zig for pi pico on here making the Simon game. The ATMel is minimally supported by the embedded zig and I read they canceled further development. But I assume digital ports will work, it’s the easiest to do, even without a HAL (hardware abstraction layer) it is pretty straightforward.
I understand why they aren’t too thrilled to continue on atmel it being an 8 bit micro controller that are more expensive than 32 bit arm cortex.
And now just do it in Vim and be done in 2 minutes ;-)
Well my typing disability is also pervasive in vim but I would be a bit faster for sure :D
@@CallousCoder Having MS and not being able to feel my fingertips I can relate to typing mostly random chars all-day 🙂
But, I didn't mean 'write the program in Vim' I meant 'do it in Vim'. Pattern match, macro, etc.
@@ViaConDias oh man MS! I’m sorry. Must be so frustrating when your body doesn’t want to keep up anymore. I’ve had a neck hernia 15 years ago and I lost control over my right arm for sometime and my thumb still feels a bit numb. I could even unscrew something for a few weeks or do card magic or play guitar. I was so frustrated. Luckily that all came back in my case. But I was seriously worried so I can only imagine what you go through. Always wondering/worrying if it progresses. Brrrr I really feel for you.
Hope it just stabilizes.
And I think you should be able to do it all in vim. I actually never calculated something in vim but you can call bc of course. Hmmmm I feel a challenge 🤣
@@CallousCoder Sorry to hear that. I was paralyzed in the right side of my body for 3 years and the doctors told me I had 1 - 2 years left. That was 16 years ago and today you wouldn't be able to see that I am sick. I am close to the best shape of my life and I have a great life. Took me 10 years in the gym but hey, life is life, and if your mother ever told you it was going to be easy she was lying. If you keep pushing forward every day then no matter the outcome, at least you know you did what you could and you can't really ask more from yourself.
I don't know what OS you are on but in Linux you would have 'calc' available to you. But a simple script that takes the number as an input and only does the actual calculations would do it too. Python or Zig, doesn't matter much.
Hope you take it on and post a follow-up video.
@@CallousCoder And when I wrote 2 minutes I wasn't joking, that is all it will take in Vim (when you know how to do it, of course)
the guy's not serious. what does he mean by it will take forever?
He means it hyperbolically. It takes longer to write a program in a general purpose language for sure -- especially when you use awk frequently. In my case I would probably spend as much time getting it done in awk :D His video is btw really good.
Oh I didn't get that. Nice video by the way@@CallousCoder
@@timibolu thanks glad you enjoyed it.
Still easier to write and use than awk
I tend to think so too 😜