mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2018-05-18, 06:34   #12
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

24·13·47 Posts
Default



Ok, we moved the multiplication tables down few positions, just before the calendar. Doing that needs knowledge of formatting, loops... The calendar is the same (some tabular stuff) but a bit more complex. Sum of 3 and 5 needs loops and a bit more advanced math, we moved it too, and all before it are just simple "printf" stuff. Normally, after a small demo of the language (like hello world, printing some text, doing simple calculus) you will introduce logic operators, then bitwise stuff, do some logic exercises, explain what a string is, introduce functions (string length), counting loops, then making tables and formatting stuff, then more complicate algorithms like searching and sorting, bubble[sort/search], recursion (factorial first, then fibo, then hanoi), then quicksort and quicksearch in sorted strings/vectors (recursive stuff). Explain the speed difference - why a bubble sort of a million values takes hours but a quicksort only seconds... Factoring integers is not simple either... But as the problem is stated (and solved) on Rosetta, it goes before recursion. Quine is the last, quite advanced concept. Not talking about the "Basic" version "10 list" hehe, but doing a quine that does something beside printing its source, or doing one that modifies its functionality from a run to the other, that is not an easy task... For the quine, we modified the link to point into the Rosetta page (sorry Nick, the wiki page was quite nice actually, but let's stay on Rosetta, as this was Mike's request, otherwise other people will add links to other strange puzzles).

Last fiddled with by LaurV on 2018-05-18 at 06:48
LaurV is offline   Reply With Quote
Old 2018-05-18, 08:19   #13
Nick
 
Nick's Avatar
 
Dec 2012
The Netherlands

22·3·5·29 Posts
Default

Quote:
Originally Posted by LaurV View Post
the wiki page was quite nice actually, but let's stay on Rosetta, as this was Mike's request, otherwise other people will add links to other strange puzzles
OK, but the link to Ken Thompson's 1984 lecture is educational so let's include it here instead:
Reflections on trusting trust
Nick is offline   Reply With Quote
Old 2018-06-01, 06:56   #17
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

24·13·47 Posts
Default

1 - http://rosettacode.org/wiki/Hello_world/Text
2 - http://rosettacode.org/wiki/User_input/Text
3 - http://rosettacode.org/wiki/Arithmetic/Integer
4 - http://rosettacode.org/wiki/Integer_sequence
5 - http://rosettacode.org/wiki/Logical_operations
6 - http://rosettacode.org/wiki/Bitwise_operations
7 - http://rosettacode.org/wiki/String_length
8 - http://rosettacode.org/wiki/Array_length
9 - http://rosettacode.org/wiki/Count_in_octal
10 - http://rosettacode.org/wiki/Substring/Top_and_tail
11 - http://rosettacode.org/wiki/Sum_multiples_of_3_and_5
12 - http://rosettacode.org/wiki/Multiplication_tables
13 - http://rosettacode.org/wiki/Reverse_a_string
14 - http://rosettacode.org/wiki/Sort_an_integer_array
15 - http://rosettacode.org/wiki/Random_numbers
16 - http://rosettacode.org/wiki/Calendar
17 - http://rosettacode.org/wiki/Exponentiation_operator
18 - http://rosettacode.org/wiki/Factors_of_an_integer
19 - http://rosettacode.org/wiki/Factors_...ersenne_number
20 - http://rosettacode.org/wiki/List_comprehensions
21 - http://rosettacode.org/wiki/Towers_of_Hanoi
22 - http://rosettacode.org/wiki/N-queens_problem
23 - http://rosettacode.org/wiki/Dining_philosophers
24 - http://rosettacode.org/wiki/Quine

Looking to the amount of code for both problems, it is not clear if this should go before or after the queens. But on the other hand, the queens as presented on Rosetta is kind of complicate (with recursion, and all, therefore this goes after the Hanoi, which is very simple recursion) - the queens are just a simple generation of all permutations of n elements in lexicographic order, and test if they can capture each-other on diagonals - the recursive method is always slower here and it needs more memory too.


edit: grrr, what did I change to my firefox that is always inserting empty lines with CR/LF, making the list spaciated and ugly? from about few weeks I need to edit all my posts to eliminate empty lines that are inserted after each paragraph... Is this a new forum stuff, new firefox update, or some shit I did?

Last fiddled with by LaurV on 2018-06-01 at 06:59
LaurV is offline   Reply With Quote
Old 2018-06-01, 07:05   #18
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

230608 Posts
Default

(see? now I would need to edit it again to eliminate the line inserted before "edit:..." haha)

And because we talked about permutations...

1 - http://rosettacode.org/wiki/Hello_world/Text
2 - http://rosettacode.org/wiki/User_input/Text
3 - http://rosettacode.org/wiki/Arithmetic/Integer
4 - http://rosettacode.org/wiki/Integer_sequence
5 - http://rosettacode.org/wiki/Logical_operations
6 - http://rosettacode.org/wiki/Bitwise_operations
7 - http://rosettacode.org/wiki/String_length
8 - http://rosettacode.org/wiki/Array_length
9 - http://rosettacode.org/wiki/Count_in_octal
10 - http://rosettacode.org/wiki/Substring/Top_and_tail
11 - http://rosettacode.org/wiki/Sum_multiples_of_3_and_5
12 - http://rosettacode.org/wiki/Multiplication_tables
13 - http://rosettacode.org/wiki/Reverse_a_string
14 - http://rosettacode.org/wiki/Sort_an_integer_array
15 - http://rosettacode.org/wiki/Random_numbers
16 - http://rosettacode.org/wiki/Calendar
17 - http://rosettacode.org/wiki/Exponentiation_operator
18 - http://rosettacode.org/wiki/Factors_of_an_integer
19 - http://rosettacode.org/wiki/Factors_...ersenne_number
20 - http://rosettacode.org/wiki/List_comprehensions
21 - http://rosettacode.org/wiki/Towers_of_Hanoi
22 - http://rosettacode.org/wiki/Permutations
23 - http://rosettacode.org/wiki/N-queens_problem
24 - http://rosettacode.org/wiki/Dining_philosophers
25 - http://rosettacode.org/wiki/Quine

Last fiddled with by LaurV on 2018-06-01 at 07:06 Reason: of course, deleting empty lines...
LaurV is offline   Reply With Quote
Old 2018-06-01, 09:59   #19
axn
 
axn's Avatar
 
Jun 2003

23·643 Posts
Default

Quote:
Originally Posted by Xyzzy View Post
What would be the ideal list of tasks to program, in a progression, to learn a new programming language?
Just to remind everyone, the objective is not to learn programming, but to learn a programming language. As such, all of the current programs are not really exposing the user to new aspects of the language. The basic stuff like operators, control structures, modules, IO have been well-represented in these lessons; too well-represented in fact. You're not going to learn anymore of a language by doing these exercises.

To go further, we have to think what additional aspects of a language needs to be covered. Here are some thoughts:

IO
a) Console IO (covered)
b) File IO
c) Graphics IO
d) Network IO
e) Database IO

Data structures
a) Arrays (covered)
b) Lists
c) Records
d) Hash maps / dictionaries

String operations
a) String extraction
b) String searching / Regex

Miscellaneous
a) Concurrency / Multithreading
b) OS calls
c) Multiprocessing / IPC
d) Compiling / Cross-compiling / Portability features
e) Memory alloc / dealloc / Garbage collection

I am sure you guys can think of other language features that need to be explored.
axn is offline   Reply With Quote
Old 2018-06-10, 15:20   #20
tServo
 
tServo's Avatar
 
"Marv"
May 2009
near the Tannhäuser Gate

3×223 Posts
Default

Quote:
Originally Posted by LaurV View Post
1 - http://rosettacode.org/wiki/Hello_world/Text
2 - http://rosettacode.org/wiki/User_input/Text
3 - http://rosettacode.org/wiki/Arithmetic/Integer
4 - http://rosettacode.org/wiki/Integer_sequence
5 - http://rosettacode.org/wiki/Logical_operations
6 - http://rosettacode.org/wiki/Bitwise_operations
7 - http://rosettacode.org/wiki/String_length
8 - http://rosettacode.org/wiki/Array_length
9 - http://rosettacode.org/wiki/Count_in_octal
10 - http://rosettacode.org/wiki/Substring/Top_and_tail
11 - http://rosettacode.org/wiki/Sum_multiples_of_3_and_5
12 - http://rosettacode.org/wiki/Multiplication_tables
13 - http://rosettacode.org/wiki/Reverse_a_string
14 - http://rosettacode.org/wiki/Sort_an_integer_array
15 - http://rosettacode.org/wiki/Random_numbers
16 - http://rosettacode.org/wiki/Calendar
17 - http://rosettacode.org/wiki/Exponentiation_operator
18 - http://rosettacode.org/wiki/Factors_of_an_integer
19 - http://rosettacode.org/wiki/Factors_...ersenne_number
20 - http://rosettacode.org/wiki/List_comprehensions
21 - http://rosettacode.org/wiki/Towers_of_Hanoi
22 - http://rosettacode.org/wiki/N-queens_problem
23 - http://rosettacode.org/wiki/Dining_philosophers
24 - http://rosettacode.org/wiki/Quine

Looking to the amount of code for both problems, it is not clear if this should go before or after the queens. But on the other hand, the queens as presented on Rosetta is kind of complicate (with recursion, and all, therefore this goes after the Hanoi, which is very simple recursion) - the queens are just a simple generation of all permutations of n elements in lexicographic order, and test if they can capture each-other on diagonals - the recursive method is always slower here and it needs more memory too.


edit: grrr, what did I change to my firefox that is always inserting empty lines with CR/LF, making the list spaciated and ugly? from about few weeks I need to edit all my posts to eliminate empty lines that are inserted after each paragraph... Is this a new forum stuff, new firefox update, or some shit I did?
It's been a while since I had firefox on my internet machine, but I seem to recall there was an option that would do this titled 'dos or windows line control ( endings ? ) or unix'
tServo is offline   Reply With Quote
Old 2020-12-11, 03:46   #21
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

2·19·263 Posts
Default

Until the end of the year I will have some slack time at work. I plan on using some of the time to learn python. I dl'ed a book on it and have been racing through the intros. One of the tasks that I will tackle early on is converting a prime testing and factoring program from the VBA it is in currently into python.
A prime testing program of some sort would be a step in programming. This is one that would be good to revisit repeatedly with regard to adding complexity to speed it and/or learning the cost of operations.
Uncwilly is online now   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
List of FFT Lengths (27.7 b2)? Belial88 Software 1 2012-11-12 16:37
Ltd's Things to do List (help if you can) ltd Prime Sierpinski Project 9 2007-11-22 09:50
Top-5000 List edorajh Riesel Prime Search 17 2006-03-28 21:57
Old ranges list Xyzzy LMH > 100M 54 2005-04-27 02:00
Who has a list? Ice9 Math 9 2004-01-27 16:32

All times are UTC. The time now is 07:18.


Sun Oct 17 07:18:28 UTC 2021 up 86 days, 1:47, 0 users, load averages: 1.35, 1.35, 1.35

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.