Nп/п : 60 из 87
 От   : Mild Shock                          2:5075/128        04 сен 23 04:31:27
 К    : Mild Shock                                            04 сен 23 14:33:03
 Тема : Re: Autum Challenge, 42 is the Answer
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
<bdad9f24-5b6a-49a8-98f9-3c2dd3e20be1n@googlegroups.com> b24231fc
@REPLY:
<6c9c0d39-8658-47b8-8526-2fd11e08fc71n@googlegroups.com> f64fb5fd
@REPLYADDR Mild Shock <bursejan@gmail.com>
@REPLYTO 2:5075/128 Mild Shock
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:
<f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com> <977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com>
<142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com> <4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com>
<3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com> <e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com>
<030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com> <db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com>
<868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com> <m2r0njgghs.fsf@logic.at>
<37516061-91b6-4129-8221-4bdb0fa59f42n@googlegroups.com> <6c9c0d39-8658-47b8-8526-2fd11e08fc71n@googlegroups.com>
@RFC-Message-ID:
<bdad9f24-5b6a-49a8-98f9-3c2dd3e20be1n@googlegroups.com>
@TZUTC: -0700
@PID: G2/1.0
@TID: FIDOGATE-5.12-ge4e8b94
Whats the Scryer Performance of this Example?

/* GNU Prolog 1.5.0 */
?- between(1,200,N), length(L,N), nth_member(I,L,E), fail; true.
(94 ms) yes

/* SWI-Prolog 9.1.14 */
?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
% 94,504,524 inferences, 4.766 CPU in 4.767 seconds (100% CPU, 19830457 Lips)
true.

That was measured on my machine,
and was a factor ca. 50x slower in SWI-Prolog.

Source Code:

nth_member(1, [M|_], M).
nth_member(N, [_|T], M) :-
  N #> 1, N1 #= N - 1,
  nth_member(N1, T, M).
--- G2/1.0
 * Origin: usenet.network (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх