Talk:Josephus problem: Difference between revisions

m
 
(4 intermediate revisions by 3 users not shown)
Line 45:
:::::: I am asking for programs that run unmodified on all versions and that is quite easy. REXX->PL/I and others I'd call translation! REXX->ooRexx is also a translation when I use new features in order to simplify the algorithm. --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 08:44, 11 May 2013 (UTC)
 
:::::;:: The Rexx programs that carry my name should work on all REXXes ( I cannot test them on others since I don't have any other - I had TSO Rexx till 12/2012). Addition on 10 May; My dream / vision is that all programs shown under REXX should work on ALL REXX implementations unless otherwise marked (No, I won't mark your programs that way - it's only a dream). Those under ooRexx will, of course, only work with ooRexx (and not Roo as was noted recently - I CAN catch your humor) --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 10:27, 10 May 2013 (UTC)
 
:::::::: All that is needed to see if a REXX program works under a Classic REXX is to (simply) run/execute the REXX program under a Classic REXX interpreter.   That would solve your (above) problem of   ''it '''should''' work on all REXXes''.   Just executing a REXX program under ooRexx doesn't mean that it works under Classic REXX as well.   This seems like an obvious and simple thing to do.   If you can't/won't use a Classic REXX interpreter and you just have ooRexx, then enter that program under the ooRexx section.   That will ensure that your program will run/execute correctly (verifiably) under the appropriate language section.     -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 18:54, 27 June 2020 (UTC)
 
Many of GS's REXX programs won't work on ooRexx because they use the things I mentioned: $ etc. as variable names and x= instead of x="" for assignment of the null string. When I try one of these programs I make the necessary little changes (c/$/d/* * and add the "") and I am off (and learn a lot from them)
Line 52 ⟶ 54:
I was going to add a considered comment but I can't be bothered in reopening the Rexx/ooRexx religious war; life's too short. I choose to ignore this trite argument about what is and what isn't Rexx --[[User:Alansam|Alansam]] ([[User talk:Alansam|talk]]) 00:32, 10 May 2013 (UTC)
 
: In calling these arguments trite is just belittling the differences and ignore the substance of the issue(s). &nbsp; The issue (argument) about what is and what isn't Rexx is a strawman argument. &nbsp; The issue is: &nbsp; what is and isn't &nbsp; '''<u>Classic</u> REXX'''. &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 18:54, 27 June 2020 (UTC)
 
==Formulae hidden to most browsers by under-tested cosmetic edits at 17:36, 21 April 2016 ==
Line 134 ⟶ 137:
;4. contractacycle<nowiki>:</nowiki> AppleScript[2], Groovy
:Method: executioner walks along killing every k'th prisoner; queue contracts to remove gaps while he walks back. (reverts to one at a time once queue too small, as next)
;5. contractalot<nowiki>:</nowiki> AutoHotkey, C#, C++, Frink, Formulae, Java (both), JavaScript[2], Julia[2], Kotlin, Lua, NanoQuery, Nim, Objeck, Oforth, Processing, Python[1], R[2], Rust, Seed7, Swift, VBScript, Vedit, VisualBasic.NET, XPL0, zkl.
:Method: executioner walks round and round, queue contracts after every kill. (This is a mix of your 3 and 5, but not MATLAB or REXX or AWK)
;6. recursive<nowiki>:</nowiki> Emacs Lisp, Icon, Julia[1], PARI/GP, PicoLisp (less the optms.n), Sidef[2] (Your 4, but not Erlang)
Line 147 ⟶ 150:
: The Forth solution is another iterative mod maths solution like R, except it uses hard coded input. (Less stack shuffling that way?) --[[User:Chunes|Chunes]] ([[User talk:Chunes|talk]]) 04:07, 27 June 2020 (UTC)
:Very impressive! Studying this will keep me busy for days.--[[User:ReeceGoding|ReeceGoding]] ([[User talk:ReeceGoding|talk]]) 18:16, 27 June 2020 (UTC)
::In the new R solution, I found it odd that you wrote
It is 1-indexed, meaning that we will have a tough time using most solutions that exploit modular arithmetic.
::(1) it is just below the existing R "Growing circle solution" which uses modular arithmetic, and
::(2) Phix has 1-based indexes and it didn't bother me. Anyway, I added R[2] to "contractalot". --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 20:43, 30 June 2020 (UTC)
::The previous solution is part of the reason why I said "most". As for 1-indexing causing problems, it's mostly to do with how you constantly have to account for modular arithmetic wanting to make things that your language wants to be 1 in to 0. It can be worked around, but it's yet another difficulty in an already hard problem.--[[User:ReeceGoding|ReeceGoding]] ([[User talk:ReeceGoding|talk]]) 21:35, 30 June 2020 (UTC)
 
:::(Modular arithmetic. Excuse me as I nab this for another reason supporting languages needing to start list indices from 0 😊) --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 23:16, 30 June 2020 (UTC)
Anonymous user