상위 질문
타임라인
채팅
관점
라쿠 (프로그래밍 언어)
펄 6로 알려진 컴퓨터 언어 위키백과, 무료 백과사전
Remove ads
라쿠(Raku, 과거 명칭: 펄 6/Perl 6)는 펄 프로그래밍 언어의 주요 버전이다. 현대의 수많은 역사적인 언어들의 요소들이 도입되어 있다. 초기 버전의 펄과의 하위 호환성이 목적은 아니지만 호환성 모드는 규격의 일부이다. 라쿠의 디자인 설계는 2000년에 시작되었다.
구현체
예제
Hello world 프로그램
say 'Hello, world'
퀵소트(Quicksort)
# Empty list sorts to the empty list
multi quicksort([]) { () }
# Otherwise, extract first item as pivot...
multi quicksort([$pivot, *@rest]) {
# Partition.
my @before = @rest.grep(* < $pivot);
my @after = @rest.grep(* >= $pivot);
# Sort the partitions.
(quicksort(@before), $pivot, quicksort(@after))
}
하노이 탑(Tower of Hanoi)
multi sub hanoi(0, $, $, $) { } # No disk, so do not do anything
multi sub hanoi($n, $a = 'A', $b = 'B', $c = 'C') { # Start with $n disks and three pegs A, B, C
hanoi $n - 1, $a, $c, $b; # firstly move top $n - 1 disks from A to B
say "Move disk $n from peg $a to peg $c"; # then move last disk from A to C
hanoi $n - 1, $b, $a, $c; # lastly move $n - 1 disks from B to C
}
Remove ads
각주
외부 링크
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads