JoyCog

Check-in [6c38f09355]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add command line wrapper for joycog.joy
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 6c38f09355d52073bf2c6ae94102a8b62fc0e6c272f3998d41665d00da981aeb
User & Date: base@atomicules.co.uk 2015-01-03 20:17:38
Context
2015-01-03
22:03
Bug/Typo fix - remove accidentally duplicated dup Leaf check-in: 3bc956d5ca user: base@atomicules.co.uk tags: origin/master, trunk
20:17
Add command line wrapper for joycog.joy check-in: 6c38f09355 user: base@atomicules.co.uk tags: origin/master, trunk
2014-03-06
22:26
Fix typo in README check-in: ad7f0d0a8d user: base@atomicules.co.uk tags: origin/master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to README.markdown.

8
9
10
11
12
13
14
15




16

17
18

19
20



I decided to do this as I was intrigued about what the theoretical progression of gears should be on my bike (you could never shift like this in practice). There is more overlap than I thought.

One possible extension I could do is to discount the ratios at the extremes of chain angle, e.g. biggest front geat and biggest rear sprocket. But wrapping my head around Joy has been hard, so I'll not do that too soon.

##Installing / Using

1. Get and compile Joy from [Kevin Albrecht's mirror](http://www.kevinalbrecht.com/code/joy-mirror/index.html) (I went with "current joy.tar.gz")
2. Start and interactive Joy session, e.g: `./joy`




3. Import like so: `/path/to/joycog.joy include.`


##Todo


- See if I can figure out making it a command line programme.










<
>
>
>
>
|
>

<
>

<
>
>
>
8
9
10
11
12
13
14

15
16
17
18
19
20
21

22
23

24
25
26
I decided to do this as I was intrigued about what the theoretical progression of gears should be on my bike (you could never shift like this in practice). There is more overlap than I thought.

One possible extension I could do is to discount the ratios at the extremes of chain angle, e.g. biggest front geat and biggest rear sprocket. But wrapping my head around Joy has been hard, so I'll not do that too soon.

##Installing / Using

1. Get and compile Joy from [Kevin Albrecht's mirror](http://www.kevinalbrecht.com/code/joy-mirror/index.html) (I went with "current joy.tar.gz")


###Interactively

2. Start an interactive Joy session from within the directory where joy was compiled so that usrlib, inilib and agglib are loaded automatically, e.g: `./joy`
3. Import joycog like so: `/path/to/joycog.joy include.`
4. Run as `[34 50] [12 13 15 17 19 21 23 26] joycog.`


###From the Command Line


5. Edit the relative path in the joycogcl.joy file
6. cd to the joy executable directory (so usrlib, inilib and agglib are loaded automatically)
7. Call as `./joy /path/to/joycogcl.joy 34 50 12 13 15 17 19 21 23 26`. I.e the first two arguments are the front chainring the rest are the cassette

Added joycogcl.joy.



















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
(* joycogcl.joy *)
(* ============ *)

(* A command line wrapper for joycog.joy
   
   - You may well need to tweak the path below to the joycog.joy file
   - Execute from within the joy executable directory (so usrlib, inilib and agglib are loaded automatically)
   - Call as `./joy /path/to/joycogcl.joy 34 50 12 13 15 17 19 21 23 26`
     I.e the first two arguments are the front chainring the rest are the cassette

*)

(* Get HOME directory *)

"HOME" getenv 

(* Add trailing slash *)

"/" concat

(* Path relative to HOME to joycog file *)

"Code/github/atomicules/joycog/joycog.joy" 

(* Include that file so can execute joycog command *)

concat include.

(* The first argument is the name of the file being executed so drop that using `rest` *)

argv rest 

(* Make a copy of it *)

dup

(* Working on the copy, assume next two arguments are for the front chainring *)

dup 2 take 

(* Swap the stack to work on rest of args again *)

swap

(* The rest are for the cassette *)

2 drop

(* But everything will be strings so need to convert to integers *)

[0 strtol] map

(* Swap stack again to convert other aggregate to integers *)

swap 

[0 strtol] map

(* Swap stack back the required way *)

swap

(* Call the actual routine *)

joycog

(* And print the results out *)

put.

(* Print a blank line *)

"\n" putchars.