[PR]
×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
プログラミング、3DCGとその他いろいろについて
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
(import (rnrs) (ironscheme clr)) (clr-using System) (define myArray (clr-new-array Int32 4)) (do ((index 0 (+ index 1))) ((= index (clr-prop-get Array Length myArray))) (clr-indexer-set! Int32[] myArray index index)) (do ((index 0 (+ index 1))) ((= index (clr-prop-get Int32[] Length myArray))) (clr-static-call Console WriteLine (clr-indexer-get Int32[] myArray index))) (clr-static-call Console ReadLine)
using System; class Program { public static int[] myArray = new int[4]; static void Main() { for (int index = 0; !(index == myArray.Length); index++) { myArray[index] = index; } for (int index = 0; !(index == myArray.Length); index++) { Console.WriteLine(myArray[index]); } Console.ReadLine(); } }
0 1 2 3
36561384 36561408 36561432 36561456
(import (rnrs) (ironscheme clr)) (clr-using System) (define myArray (clr-new-array Int32 1)) (clr-indexer-set! Int32[] myArray 0 42) (display (clr-indexer-get Int32[] myArray 0)) (clr-static-call Console ReadLine)C#でいうとこんな感じです:
using System; class Program { public static int[] myArray = new int[1]; static void Main() { myArray[0] = 42; Console.Write(myArray[0]); Console.ReadLine(); } }
42
(import (rnrs) (ironscheme clr)) (clr-using System) (define myArray (clr-new-array Int32 1)) (define value 42) (clr-indexer-set! Int32[] myArray 0 value) (display (clr-indexer-get Int32[] myArray 0)) (clr-static-call Console ReadLine)
using System; class Program { public static int[] myArray = new int[1]; public static int value = 42; static void Main() { myArray[0] = value; Console.Write(myArray[0]); Console.ReadLine(); } }
42
(import (rnrs) (ironscheme clr)) (clr-using System) (define myArray (clr-new-array Int32 1)) (let ((value 42)) (clr-indexer-set! Int32[] myArray 0 value) (clr-static-call Console WriteLine value)) (clr-static-call Console WriteLine (clr-indexer-get Int32[] myArray 0)) (clr-static-call Console ReadLine)
using System; class Program { public static int[] myArray = new int[1]; static void Main() { int value = 42; myArray[0] = value; Console.Write(myArray[0]); Console.ReadLine(); } }
42 39708184
(import (rnrs) (ironscheme clr)) (let ((value 42)) (clr-static-call System.Console WriteLine "{0} {1}" (clr-call System.Object GetType value) value)) (clr-static-call System.Console ReadLine)
class Program { public static int[] myArray = new int[1]; static void Main() { int value = 42; System.Console.WriteLine("{0} {1}", value.GetType(), value); System.Console.ReadLine(); } }
System.Int32 42
(import (rnrs) (ironscheme clr)) (clr-using System) (define myArray (clr-new-array Int32 4)) (do ((index 0 (+ index 1))) ((= index (clr-prop-get Array Length myArray))) (clr-indexer-set! Int32[] myArray index (clr-cast Int32 index))) (do ((index 0 (+ index 1))) ((= index (clr-prop-get Int32[] Length myArray))) (display (clr-indexer-get Int32[] myArray index)) (newline)) (clr-static-call Console ReadLine)C#版:
using System; class Program { public static int[] myArray = new int[4]; static void Main() { for (int index = 0; !(index == myArray.Length); index++) { myArray[index] = (int)index; } for (int index = 0; !(index == myArray.Length); index++) { Console.WriteLine(myArray[index]); } Console.ReadLine(); } }
0 1 2 3あれ…
(import (rnrs) (ironscheme clr)) (clr-using System) (define myValue 0) (let ((value 42)) (set! myValue value) (clr-static-call Console WriteLine value)) (clr-static-call Console WriteLine myValue) (clr-static-call Console ReadLine)
42 42正常です。