|
|
Line 141: |
Line 141: |
|
return 0; |
|
return 0; |
|
}</lang> |
|
}</lang> |
|
|
|
⚫ |
=={{header| Chicken Scheme}}== |
|
⚫ |
Chicken Scheme has the {{{ -ss }}} flag for the interpreter, but compiled Chicken Scheme programs do not have scripted main unless the behavior is added manually to the code. |
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
exec csi -ss $0 ${1+"$@"} |
|
⚫ |
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
(require-extension srfi-1) ; lists |
|
|
|
|
⚫ |
(define (meaning-of-life) 42) |
|
|
|
|
⚫ |
|
|
⚫ |
(display (format "Main: The meaning of life is ~a\n" (meaning-of-life))) |
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
(if (string=? (car (argv)) "csi") |
|
⚫ |
(let ((s-index (list-index (lambda (x) (string-contains x "-s")) (argv)))) |
|
⚫ |
|
|
⚫ |
(cons 'interpreted (list-ref (argv) (+ 1 s-index))) |
|
⚫ |
|
|
⚫ |
(cons 'compiled (car (argv))))) |
|
|
|
|
⚫ |
(if (equal? (car (program)) 'compiled) |
|
⚫ |
(main (cdr (argv))))</lang> |
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
exec csi -ss $0 ${1+"$@"} |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
(load "scriptedmain.scm") |
|
⚫ |
(display (format "Test: The meaning of life is ~a\n" (meaning-of-life))) |
|
⚫ |
|
|
|
|
|
|
|
=={{header|Clojure}}== |
|
=={{header|Clojure}}== |
Line 1,597: |
Line 1,554: |
|
List(42, 21, 64, 32, 16, 8, 4, 2, 1) |
|
List(42, 21, 64, 32, 16, 8, 4, 2, 1) |
|
It has 9 elements.</pre> |
|
It has 9 elements.</pre> |
|
|
|
|
⚫ |
|
|
|
{{Works with|Chicken Scheme}} |
|
⚫ |
Chicken Scheme has the {{{ -ss }}} flag for the interpreter, but compiled Chicken Scheme programs do not have scripted main unless the behavior is added manually to the code. |
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
exec csi -ss $0 ${1+"$@"} |
|
⚫ |
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
(require-extension srfi-1) ; lists |
|
|
|
|
⚫ |
(define (meaning-of-life) 42) |
|
|
|
|
⚫ |
|
|
⚫ |
(display (format "Main: The meaning of life is ~a\n" (meaning-of-life))) |
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
(if (string=? (car (argv)) "csi") |
|
⚫ |
(let ((s-index (list-index (lambda (x) (string-contains x "-s")) (argv)))) |
|
⚫ |
|
|
⚫ |
(cons 'interpreted (list-ref (argv) (+ 1 s-index))) |
|
⚫ |
|
|
⚫ |
(cons 'compiled (car (argv))))) |
|
|
|
|
⚫ |
(if (equal? (car (program)) 'compiled) |
|
⚫ |
(main (cdr (argv))))</lang> |
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
exec csi -ss $0 ${1+"$@"} |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
(load "scriptedmain.scm") |
|
⚫ |
(display (format "Test: The meaning of life is ~a\n" (meaning-of-life))) |
|
⚫ |
|
|
|
|
|
|
=={{header|Smalltalk}}== |
|
=={{header|Smalltalk}}== |