Perl code to F sharp code
I have some code that I have written in Perl and I need to convert it to F Sharp code. I have no idea where to start.

Suppose the program is run as follows: ./program.perl 5 1 4

The algorithm will determine the highest summation that can be created using at most 5 instances of the numbers 1 and 4 before a summation cannot be created. In this example, the highest summation is 14, since 14 can be made using the combination of [4,4,4,1,1], and 15 cannot be made using 5 or less numbers.

Any help would be much appreciated. Below is the Perl code. Thanks in advance.

    #!/usr/bin/perl
    my ($n, @stamps) = @ARGV;
    print "n: $n\n";
    my @_solved;        # Will grow as necessary

    # How many stamps are needed to represent a value of $v cents?
    sub solve($) {
        my ($v) = @_;
        print "v: $v\n";
        my $min = $n + 1;
        print "min: $min\n";

        return 0 if $v == 0;

        foreach (@stamps) {
            print "compare val: "; print $_; print "\n";
            if ($v >= $_) {
                print "solved[v - _]: solved[$v - $_]: "; print $_solved[$v - $_]; print "\n";
                my $try = $_solved[$v - $_] + 1;
                print "try: $try\n";
                $min = $try if $try < $min;
            }
        }

        $_solved[$v] = $min;
        print "min at end: $min\n";
        return $min;
    }

    my $max = (sort { $a <=> $b } @stamps)[-1];
    print "stamps: @stamps\n";
    print "max: $max\n";

    # Main loop
    print "max*n = $max * $n = "; print $max * $n; print "\n";

    for (my $i = 0; $i <= $max * $n; ++$i) {
        my $ans = solve($i);
        print "ans: $ans\n";
        if ($ans > $n) {
            print "$i cannot be represented with <= $n stamps of values " . join(", ", @stamps) . ".\n";
            last;
        }
    }



Perl code to F sharp code
===

I have some code that I have written in Perl and I need to convert it to F Sharp code. I have no idea where to start.

Suppose the program is run as follows: ./program.perl 5 1 4

The algorithm will determine the highest summation that can be created using at most 5 instances of the numbers 1 and 4 before a summation cannot be created. In this example, the highest summation is 14, since 14 can be made using the combination of [4,4,4,1,1], and 15 cannot be made using 5 or less numbers.

Any help would be much appreciated. Below is the Perl code. Thanks in advance.

    #!/usr/bin/perl
    my ($n, @stamps) = @ARGV;
    print "n: $n\n";
    my @_solved;        # Will grow as necessary

    # How many stamps are needed to represent a value of $v cents?
    sub solve($) {
        my ($v) = @_;
        print "v: $v\n";
        my $min = $n + 1;
        print "min: $min\n";

        return 0 if $v == 0;

        foreach (@stamps) {
            print "compare val: "; print $_; print "\n";
            if ($v >= $_) {
                print "solved[v - _]: solved[$v - $_]: "; print $_solved[$v - $_]; print "\n";
                my $try = $_solved[$v - $_] + 1;
                print "try: $try\n";
                $min = $try if $try < $min;
            }
        }

        $_solved[$v] = $min;
        print "min at end: $min\n";
        return $min;
    }

    my $max = (sort { $a <=> $b } @stamps)[-1];
    print "stamps: @stamps\n";
    print "max: $max\n";

    # Main loop
    print "max*n = $max * $n = "; print $max * $n; print "\n";

    for (my $i = 0; $i <= $max * $n; ++$i) {
        my $ans = solve($i);
        print "ans: $ans\n";
        if ($ans > $n) {
            print "$i cannot be represented with <= $n stamps of values " . join(", ", @stamps) . ".\n";
            last;
        }
    }


