mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   jvang (https://www.mersenneforum.org/forumdisplay.php?f=153)
-   -   ¿Learning how to learn… (https://www.mersenneforum.org/showthread.php?t=23429)

jvang 2018-08-07 02:55

Finished up another level 5 kata, so my profile leveled up! :w00t:

It was some little “hashtag generator,” just removing whitespace and capitalizing each word. Pretty easy for a level 5 kata...

henryzz 2018-08-07 11:35

[QUOTE=jvang;493244]I don't have much experience with arrays (are they just lists of lists?), so I don't know how the newval is located with the rows and columns. At first glance I'd think that row 1, column 2 would be the second 2 in the first list, but instead it's the 3rd value of the second list... :jvang:

Got my first couple of level 5 katas completed, [URL="https://www.codewars.com/kata/51fc12de24a9d8cb0e000001"]ISBN-10 Validation[/URL] and [URL="https://www.codewars.com/kata/530e15517bc88ac656000716"]Rot13[/URL]. Took some weird thinking and lots of trial and error, but definitely worth a shot.

Learning about basic job control in Linux, using the [c]fg[/c] and [c]bg[/c] commands or ending input lines with [c]&[/c]. It's helpful when I'm writing large amounts of data to a USB drive, or doing something similar that takes a long time, since I can get the prompt back immediately for other tasks. From a quick look on Google it seems that you can write bash scripts to automatically start/stop processes, but that seems kinda complicated :unsure:[/QUOTE]

They are lists of lists. The indices of lists start at 0 rather than 1.

jvang 2018-08-07 13:47

[QUOTE=henryzz;493344]They are lists of lists. The indices of lists start at 0 rather than 1.[/QUOTE]

I keep forgetting that; a recent kata I did gave me problems because I tried to start with 1 :ermm:

jvang 2018-08-08 03:11

Learnt some new stuff in Haskell; [c]scanl[/c], [c]dropWhile[/c], and [c]takeWhile[/c]. [c]scanl[/c] is like [c]foldl[/c], but returns a list of each iteration rather than end result ([c]last (scanl1 f xs) = foldl1 f xs[/c]). The other 2 functions take or drop elements of an input list based on whether each element passes a specified Boolean test/predicate. Very neat, and allows for some cool interactions with [c]scanl[/c] where you can exclude values above or below a value or something.

I've seen (and used) a lambda syntax in some programs that looks like:

[CODE]\a -> f a
alternatingCase = map (\a -> if isUpper a == True then toLower a else toUpper a)[/CODE]

It seems to be some way to make a temporary variable that suits the needs of the expression it is used in? :unsure:

Working on another kata, [URL="https://www.codewars.com/kata/weight-for-weight/"]Weight for weight[/URL]; I've gotten pretty far into it, but I'm stuck.

I have two lists of tuples, the first of which are the original values of an input zipped with another list to attach indices. The second list has the altered (weighted) values that are sorted in the different order, with the same indices as the original list. I'm trying to figure out how to "map" the original values back to the differently ordered list. I am learning a bit with pattern matching tuples, but I don't fully get it yet and I don't know how to process the inputs; I think I've made it work for a really basic input of two tuples but that's it... :help:

Edit: I think I coded the indices in a way that they are out of order in the second list, and it's confusing me because now I can't remember whether I wanted the second list's indices sorted or not :max:

Nick 2018-08-08 08:25

[QUOTE=jvang;493404]I've seen (and used) a lambda syntax in some programs that looks like:
[CODE]alternatingCase = map (\a -> if isUpper a == True then toLower a else toUpper a)[/CODE]It seems to be some way to make a temporary variable that suits the needs of the expression it is used in? :unsure:
[/QUOTE]
Usually, we define functions before we use them, giving them a name so that we can refer to them later.
For example, the first word after "map" is usually the name of a function.

The lambda syntax allows you to insert the code of a function directly at the point where you use it (and then it doesn't require a name).
By the way, the following are all equivalent:
[CODE]
if isUpper a
if isUpper a==True
if (isUpper a==True)==True

[/CODE]- but the first one is shortest!


[QUOTE=jvang;493404]
Working on another kata, [URL="https://www.codewars.com/kata/weight-for-weight/"]Weight for weight[/URL]; I've gotten pretty far into it, but I'm stuck.:help:

Edit: I think I coded the indices in a way that they are out of order in the second list, and it's confusing me because now I can't remember whether I wanted the second list's indices sorted or not :max:[/QUOTE]
Earlier in this thread, you wrote a function which sorts integers.
If you replace the line "if x>y" in that function with "if f(x)>f(y)" where f is a new function calculating the weight of its argument,
then you can avoid using so many lists, perhaps?

jvang 2018-08-08 20:34

Thanks for the clarifications! I’ll see what I can make work with our sortt function.

I was looking through our small collection of books and found [U]Calculus[/U], by Michael Spivak, in its 3rd edition (1994). Apparently it’s from when my dad did some college stuff, and it was the definitive text for calculus when he was learning. Is it still relevant and worth a read?

Nick 2018-08-09 06:44

[QUOTE=jvang;493452]I was looking through our small collection of books and found [U]Calculus[/U], by Michael Spivak, in its 3rd edition (1994). Apparently it’s from when my dad did some college stuff, and it was the definitive text for calculus when he was learning. Is it still relevant and worth a read?[/QUOTE]
Spivak's Calculus introduces you to calculus in the way that it is done by real mathematicians.
It does not just present tricks for performing calculations (as some books do),
but gives you a first look at the deeper mathematical ideas lying behind the calculations and how these ideas fit together.
It is a challenging book but definitely worthwhile.
I have known people who read that book and found the ideas in it so fascinating that they became addicted to doing mathematics!

jvang 2018-08-10 03:09

[QUOTE=Nick;493477]Spivak's Calculus introduces you to calculus in the way that it is done by real mathematicians.
It does not just present tricks for performing calculations (as some books do),
but gives you a first look at the deeper mathematical ideas lying behind the calculations and how these ideas fit together.
It is a challenging book but definitely worthwhile.
I have known people who read that book and found the ideas in it so fascinating that they became addicted to doing mathematics![/QUOTE]

Sounds cool, from what the first couple of chapters cover I can tell that your first sentence is very true! I'm definitely not a fan of textbooks that are full of lessons that teach things like "Mathematicians [I]hate[/I] this trick! Learn this one Simple™ mnemonic/acronym/memorization thingy to solve math problems in a flash!", but that's how a lot of textbooks that I read in high school have been. The textbooks at ASMSA were definitely better (they were not just "college-level™" books, but actually readings from classes at the University of Arkansas at Little Rock, from which we got our concurrent credit program.). I look forward to comparing Spivak's [U]Calculus[/U] to the textbook at the local high school, perhaps even bringing it along as a weapon of math instruction! :devil:

CodeWars' website is actually pretty annoying for me. I don't know if these problems are mine alone, but the website itself is excruciatingly slow to load, sometimes it fails to load at all, and it will randomly log me out, either between certain periods of usage or even as I am typing. It logged me out sometime last night, and failed to save any of my code for the kata that I'm spending to much time on, so I'm in the process of retyping that program... :rant:

I read a few chapters in the Linux Essentials book that I'm learning from, and am only now grasping how long ago it was written. The author's prompt examples show that it was being written in about 1995! He refers to things like Netscape, 80386 processors, and DOS in a very casual way, since at the time those things were very common. I had to ask my dad what OS/2 was, since the author made references to it. His PC had 24 megabytes of RAM, the math coprocessor was separate from the i386 chip, Linux booted off of LILO instead of GRUB, and his line(!) printer was connected to a parallel port rather than a serial port. However, he did use a 1024x768 monitor, which doesn't sound too bad for 20+ years ago :ermm:

Then again, there's a bunch of stuff he talks about that is still around. bash existed back then, with many of the same commands (less doesn't exist yet, so he uses more). Other than LILO being replaced with GRUB, the boot sequence is pretty similar. The IP protocols his hardware used is still in use today, and the X Windows System doesn't look too bad. I'll probably have little trouble passing the Linux Essentials test, but it is amazing to read about how this ancient stuff worked, and that a lot of the software and protocols are still widespread! :whee:

henryzz 2018-08-10 23:49

The logging out is a bug when you have more than one tab open for codewars.

jvang 2018-08-11 01:23

[QUOTE=henryzz;493638]The logging out is a bug when you have more than one tab open for codewars.[/QUOTE]

I do tend to have many tabs open for CodeWars, so that's explained...

The Linux Essentials had a much more comprehensive (albeit very simple) chapter on job control compared to the Debian book. Here’s a list of the basic job control commands that are covered:
[LIST][*]fg, return a job (optionally specified with %num parameter) to the foreground[*]&, end a bash input line with & to automatically run the command in the background[*]bg, run a job (with optional %num parameter) in the background[*]kill, terminates a job (optional parameters are %num or the job PID; I read from the Debian book that there is an additional parameter to specify the signal to send, which typically varies between a “clean” termination and a forced one.)[*]jobs, list all jobs that are currently running or suspended and information about each[*]ctrl-c kills the job currently in the foreground, ctrl-z suspends it[/LIST]
& is probably the most useful for me so far; I don’t like waiting for the prompt to come back :grin:

I’ve finished up my schedule for school, there’s just a couple more bits of paperwork to fill out. The last two periods on my schedule are some online concurrent credit classes through the local CC, Computer Fundamentals and General Psychology. Since they’re required for the first year of college in Arkansas I’ll have a more relaxed schedule once I get there, or something. I hope they're not too much work, since I still have 6 other classes to worry about...I’ll figure out soon, since school starts on Monday! :jvang:

jvang 2018-08-12 01:37

We're swapping around some hard drives between our many computers, so I’m doing a new installation on my desktop (ZorinOS hasn’t done much more than look a bit cool). I like the KDE desktop on my OpenSUSE laptop, so I’m getting a Kubuntu USB drive ready. It’s been a while since I worked with Ubuntu but I’ve heard it’s derived from Debian and very similar, so I’ll be able to use what I’ve learned in Debian's command line. The hard drive we’re swapping in is an ancient 40 GB HDD(!) from our original PS3 :ermm:

So I’ll have 2 distros running, and I’ve used Debian and CentOS in the past. Are there any others I should try for variety?


All times are UTC. The time now is 10:06.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.