Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Elvis is my copilot." -- Cal Keegan


devel / comp.lang.prolog / Re: Not being a Haskell programmer is trendy!

SubjectAuthor
* Not being a Haskell programmer is trendy!Mild Shock
+- Re: Not being a Haskell programmer is trendy!Mild Shock
+* Re: Not being a Haskell programmer is trendy!Mild Shock
|`* Re: Not being a Haskell programmer is trendy!Mild Shock
| `- Re: Not being a Haskell programmer is trendy!Mild Shock
+* Re: Not being a Haskell programmer is trendy!Mild Shock
|`* Re: Not being a Haskell programmer is trendy!Mild Shock
| `* Re: Not being a Haskell programmer is trendy!Mild Shock
|  `* Re: Not being a Haskell programmer is trendy!Mild Shock
|   `* Re: Not being a Haskell programmer is trendy!Mild Shock
|    `* Re: Not being a Haskell programmer is trendy!Mild Shock
|     `- Re: Not being a Haskell programmer is trendy!Mild Shock
`- Re: Not being a Haskell programmer is trendy!Mild Shock

1
Not being a Haskell programmer is trendy!

<upjgq3$19qjv$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10279&group=comp.lang.prolog#10279

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!news.neodome.net!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Not being a Haskell programmer is trendy!
Date: Fri, 2 Feb 2024 20:46:12 +0100
Message-ID: <upjgq3$19qjv$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 2 Feb 2024 19:46:11 -0000 (UTC)
Injection-Info: solani.org;
logging-data="1370751"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:5LjdVNC/Kc/OaKPb4I+8URRt36k=
X-User-ID: eJwNydsBADEEBMCWiPVIOQT9l3A3v6NibM9hatDVLS5eO8fBcqcjZBMEqrgamipU5Dnu/4JvWjEKiOh+0zMfMtoVOA==
X-Mozilla-News-Host: news://news.solani.org:119
 by: Mild Shock - Fri, 2 Feb 2024 19:46 UTC

Just watched 2 videos from Scala and the
year 2023 and nearly chocked on my yoghurt,

especially when I saw the first presenter got a
headeache from early returns. LoL

Async/Await for the Monadic Programmer
https://www.youtube.com/watch?v=OH5cxLNTTPo

DIRECT STYLE SCALA Scalar Conference 2023
https://www.youtube.com/watch?v=0Fm0y4K4YO8

Whats the bottom line: All because they discovered they
could do async/await as well?

Re: Not being a Haskell programmer is trendy!

<upjhl9$19quc$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10280&group=comp.lang.prolog#10280

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Fri, 2 Feb 2024 21:00:41 +0100
Message-ID: <upjhl9$19quc$1@solani.org>
References: <upjgq3$19qjv$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 2 Feb 2024 20:00:41 -0000 (UTC)
Injection-Info: solani.org;
logging-data="1371084"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:173ACynoLunvmciCuQnW6Zrrnsk=
X-User-ID: eJwFwQcBACAIBMBKiM+Kg4z+EbyTq0fLoKKQlY02Rr1suG6V3hEaSTsTVAykPHJ+jfQxPVTBPZjL6zLR9QFiBhX3
In-Reply-To: <upjgq3$19qjv$1@solani.org>
 by: Mild Shock - Fri, 2 Feb 2024 20:00 UTC

BTW: The Go programming language which has direct
style runs the primes example in 0.6 seconds.
The primes example is here:

The Go Playground
https://go.dev/play/

Just choose the Concurrent Prime Sieve example.
Twice as slow as the 0.3 seconds of Haskell but
nevertheless faster than Prolog.

For those interested was comparing to:

Prolog Hand Rolled Lazy Lists via call/n:
=============================================

iter(F,A,A,iter(F,B)) :- call(F,A,B).

take(0, _, []) :- !.
take(N, C, [X|L]) :- M is N-1, call(C, X, D), take(M, D, L).

modfilt(C, M, X, E) :- call(C, Y, D), modfilt2(D, M, Y, X, E).

modfilt2(D, M, Y, X, E) :- Y mod M =:= 0, !, modfilt(D, M, X, E).
modfilt2(D, M, X, X, modfilt(D,M)).

primes(C, X, primes(modfilt(D,X))) :- call(C, X, D).

/* on @emiruz machine */
?- time(take(5000,primes(iter(succ,2)),_)).

% 38,009,267 inferences, 2.005 CPU in 2.005
seconds (100% CPU, 18954407 Lips)

true.

Haskell David Turner's sieve (SASL Language Manual, 1983)
=============================================

sieve :: [Integer] -> [Integer]

sieve [] = []

sieve (p:xs) = p : sieve [x | x <- xs, rem x p > 0]

/* on @emiruz machine */
time ./primes
% real 0m0.312s
% user 0m0.294s
% sys 0m0.005s

https://wiki.haskell.org/Prime_numbers#Turner.27s_sieve_-_Trial_division

Disclaimer: Didn't run the Go version by myself
yet. Have first to install Go etc.. Somebody
else run it and reported 0.6 seconds.

Mild Shock schrieb:
> Just watched 2 videos from Scala and the
> year 2023 and nearly chocked on my yoghurt,
>
> especially when I saw the first presenter got a
> headeache from early returns. LoL
>
> Async/Await for the Monadic Programmer
> https://www.youtube.com/watch?v=OH5cxLNTTPo
>
> DIRECT STYLE SCALA Scalar Conference 2023
> https://www.youtube.com/watch?v=0Fm0y4K4YO8
>
> Whats the bottom line: All because they discovered they
> could do async/await as well?

Re: Not being a Haskell programmer is trendy!

<ur3g0l$d0vr$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10284&group=comp.lang.prolog#10284

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!news.chmurka.net!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Wed, 21 Feb 2024 01:27:03 +0100
Message-ID: <ur3g0l$d0vr$1@solani.org>
References: <upjgq3$19qjv$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Feb 2024 00:27:01 -0000 (UTC)
Injection-Info: solani.org;
logging-data="427003"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:P3GymmLTfiX8NIA+OrgA4sx9AGA=
X-User-ID: eJwFwQcBwEAIBDBLzIOXQxn+JTRxBaPD4DA/PwGZjy5F0kCjiF+WY21WQuZDHVufP4Wngai2pSeSi3n1BzANFMc=
In-Reply-To: <upjgq3$19qjv$1@solani.org>
 by: Mild Shock - Wed, 21 Feb 2024 00:27 UTC

My revecent Async/Await surrogates for JDK 21
provide coroutines with suspend/resume semantics.
They are not continuations. They aim is to provide
async/await and not only setTimeout().

As a result you don't need to write libraries
with a continuation parameters. This is very unlike
nonsense such as the JavaScript express web framework.

stackfulness
In contrast to a stackless coroutine a stackful
coroutine can be suspended from within a nested
stackframe. Execution resumes at exactly the same
point in the code where it was suspended before.

stackless
With a stackless coroutine, only the top-level routine
may be suspended. Any routine called by that top-level
routine may not itself suspend. This prohibits
providing suspend/resume operations in routines within
a general-purpose library.
https://www.boost.org/doc/libs/1_57_0/libs/coroutine/doc/html/coroutine/intro.html#coroutine.intro.stackfulness

Mild Shock schrieb:
> Just watched 2 videos from Scala and the
> year 2023 and nearly chocked on my yoghurt,
>
> especially when I saw the first presenter got a
> headeache from early returns. LoL
>
> Async/Await for the Monadic Programmer
> https://www.youtube.com/watch?v=OH5cxLNTTPo
>
> DIRECT STYLE SCALA Scalar Conference 2023
> https://www.youtube.com/watch?v=0Fm0y4K4YO8
>
> Whats the bottom line: All because they discovered they
> could do async/await as well?

Re: Not being a Haskell programmer is trendy!

<ur3g2r$d0vr$2@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10285&group=comp.lang.prolog#10285

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!news.nntp4.net!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Wed, 21 Feb 2024 01:28:13 +0100
Message-ID: <ur3g2r$d0vr$2@solani.org>
References: <upjgq3$19qjv$1@solani.org> <ur3g0l$d0vr$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Feb 2024 00:28:11 -0000 (UTC)
Injection-Info: solani.org;
logging-data="427003"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:MNu5TwXNadjRQGlYFcfwVIGLvic=
X-User-ID: eJwNwgkRADEIBDBL5S9yFgr+JdxlYuLkHermamurXBhkNF+qzeuC4aOsAvi229KDYjUt/h2HrPLVCCGq8QFa9hXs
In-Reply-To: <ur3g0l$d0vr$1@solani.org>
 by: Mild Shock - Wed, 21 Feb 2024 00:28 UTC

Its also proof of concept that no stack copying
is necessary. Well its not 100% true the Prolog
interpreter does a little bit unwind and rewind

during the '$YIELD'/1 instruction. But we do
nowhere copy some native stack, this is unlike
Martin Odersky's speculation, he might implement

someting with stack copying. Except that a virtual
threads might using a copying when they resize
their stack, I don't see any need for copying.

Also sometimes a callback can be piggy packed on
an existing coroutine if it doesn't yield itself,
I am already using this in Dogelog Player as an

optimization. The idea to use semaphores in my
implementation can be credited to this paper
from 1980 where semaphores are the main switchpoint:

Extension of Pascal and its Application to
Quasi-Parallel Programming and Simulation, Software -
Practice and Experience, 10 (1980), 773-789
J. Kriz and H. Sandmayr
https://www.academia.edu/47139332

But my experience with JDK 21 virtual threads
is still poor, I am only beginning to explore them
as a way to have a large number of coroutines.

Mild Shock schrieb:
> My revecent Async/Await surrogates for JDK 21
> provide coroutines with suspend/resume semantics.
> They are not continuations. They aim is to provide
> async/await and not only setTimeout().
>
> As a result you don't need to write libraries
> with a continuation parameters. This is very unlike
> nonsense such as the JavaScript express web framework.
>
> stackfulness
> In contrast to a stackless coroutine a stackful
> coroutine can be suspended from within a nested
> stackframe. Execution resumes at exactly the same
> point in the code where it was suspended before.
>
> stackless
> With a stackless coroutine, only the top-level routine
> may be suspended. Any routine called by that top-level
> routine may not itself suspend. This prohibits
> providing suspend/resume operations in routines within
> a general-purpose library.
> https://www.boost.org/doc/libs/1_57_0/libs/coroutine/doc/html/coroutine/intro.html#coroutine.intro.stackfulness
>
>
> Mild Shock schrieb:
>> Just watched 2 videos from Scala and the
>> year 2023 and nearly chocked on my yoghurt,
>>
>> especially when I saw the first presenter got a
>> headeache from early returns. LoL
>>
>> Async/Await for the Monadic Programmer
>> https://www.youtube.com/watch?v=OH5cxLNTTPo
>>
>> DIRECT STYLE SCALA Scalar Conference 2023
>> https://www.youtube.com/watch?v=0Fm0y4K4YO8
>>
>> Whats the bottom line: All because they discovered they
>> could do async/await as well?
>

Re: Not being a Haskell programmer is trendy!

<ur3g68$d0vr$3@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10286&group=comp.lang.prolog#10286

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Wed, 21 Feb 2024 01:30:02 +0100
Message-ID: <ur3g68$d0vr$3@solani.org>
References: <upjgq3$19qjv$1@solani.org> <ur3g0l$d0vr$1@solani.org>
<ur3g2r$d0vr$2@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Feb 2024 00:30:00 -0000 (UTC)
Injection-Info: solani.org;
logging-data="427003"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:go7wp0mYdWDy7Sonz+zfs26yk7I=
In-Reply-To: <ur3g2r$d0vr$2@solani.org>
X-User-ID: eJwNyMkRACAIBLCWEDm0HGWX/kvQXyY+Y0SlhYd5eyOX2GdcD8mF5pZSPaexB7WEzLPnCk1eGZlsL/yBEVA8S7oWAA==
 by: Mild Shock - Wed, 21 Feb 2024 00:30 UTC

Also the Kotlin language and runtime might suffer from
not enough "DIRECT STYLE" and even ignoring Doug Leas
java.util.concurrent.Flow, devlivering some bloated

redundant nonsense I speculate from glossing over it.
Flow has an interesting history. And all the new JDK 21
integrate HTTP server and HTTP client make use of

the interfaces bundled by the class Flow. But I am
tapping into it via ordinary InputStream and OutputStream.

Reactive Streams started as an initiative in late 2013
between engineers at Netflix, Pivotal and Lightbend.
Reactive Streams were proposed to become part of
Java 9 by Doug Lea, leader of JSR 166 as a new Flow
class that would include the interfaces currently
provided by Reactive Streams.
https://en.wikipedia.org/wiki/Reactive_Streams

Mild Shock schrieb:
> Its also proof of concept that no stack copying
> is necessary. Well its not 100% true the Prolog
> interpreter does a little bit unwind and rewind
>
> during the '$YIELD'/1 instruction. But we do
> nowhere copy some native stack, this is unlike
> Martin Odersky's speculation, he might implement
>
> someting with stack copying. Except that a virtual
> threads might using a copying when they resize
> their stack, I don't see any need for copying.
>
> Also sometimes a callback can be piggy packed on
> an existing coroutine if it doesn't yield itself,
> I am already using this in Dogelog Player as an
>
> optimization. The idea to use semaphores in my
> implementation can be credited to this paper
> from 1980 where semaphores are the main switchpoint:
>
> Extension of Pascal and its Application to
> Quasi-Parallel Programming and Simulation, Software -
> Practice and Experience, 10 (1980), 773-789
> J. Kriz and H. Sandmayr
> https://www.academia.edu/47139332
>
> But my experience with JDK 21 virtual threads
> is still poor, I am only beginning to explore them
> as a way to have a large number of coroutines.
>
> Mild Shock schrieb:
>> My revecent Async/Await surrogates for JDK 21
>> provide coroutines with suspend/resume semantics.
>> They are not continuations. They aim is to provide
>> async/await and not only setTimeout().
>>
>> As a result you don't need to write libraries
>> with a continuation parameters. This is very unlike
>> nonsense such as the JavaScript express web framework.
>>
>> stackfulness
>> In contrast to a stackless coroutine a stackful
>> coroutine can be suspended from within a nested
>> stackframe. Execution resumes at exactly the same
>> point in the code where it was suspended before.
>>
>> stackless
>> With a stackless coroutine, only the top-level routine
>> may be suspended. Any routine called by that top-level
>> routine may not itself suspend. This prohibits
>> providing suspend/resume operations in routines within
>> a general-purpose library.
>> https://www.boost.org/doc/libs/1_57_0/libs/coroutine/doc/html/coroutine/intro.html#coroutine.intro.stackfulness
>>
>>
>> Mild Shock schrieb:
>>> Just watched 2 videos from Scala and the
>>> year 2023 and nearly chocked on my yoghurt,
>>>
>>> especially when I saw the first presenter got a
>>> headeache from early returns. LoL
>>>
>>> Async/Await for the Monadic Programmer
>>> https://www.youtube.com/watch?v=OH5cxLNTTPo
>>>
>>> DIRECT STYLE SCALA Scalar Conference 2023
>>> https://www.youtube.com/watch?v=0Fm0y4K4YO8
>>>
>>> Whats the bottom line: All because they discovered they
>>> could do async/await as well?
>>
>

Re: Not being a Haskell programmer is trendy!

<urt0n0$qgjc$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10298&group=comp.lang.prolog#10298

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Fri, 1 Mar 2024 17:45:20 +0100
Message-ID: <urt0n0$qgjc$1@solani.org>
References: <upjgq3$19qjv$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Mar 2024 16:45:20 -0000 (UTC)
Injection-Info: solani.org;
logging-data="868972"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:WGJsggVz6NMLkDpttvfuy65KBSc=
In-Reply-To: <upjgq3$19qjv$1@solani.org>
X-User-ID: eJwNwokRwDAIA7CV+IybcSCF/UdoT4Kn5mUkMrC/GlHxYjNrLqIFW4WzvMHBCk7ZlqFb8VI9Gbb7mJ2e8Q9e5xW6
 by: Mild Shock - Fri, 1 Mar 2024 16:45 UTC

Can the golang interfaces handling be compared to lazy/sharing
in the non-strict semantics of Haskell? Just curious, maybe
there is nevertheless a chance to speed up Prolog call/n.

After all Haskell and Prolog are very similar they champion
non-strict features. Most novice Prolog programmers are
suprised by this behaviour, and that they need to invoke is/2,

making evaluation explicit, why is it not implicit like in every
other programming language (warning the example could
be misleading, its not what I am attacking, only motivation here):

?- X = 1+2.
X = 1+2

But then there are other more important corner where Prolog
and Haskell are basically the same, i.e. call/n.

The sharing in Haskell could then give semantic to monomorphic
and polymorphic caches. Did somebody write a paper about
golang interfaces handling, relating it to non-strict behaviour?

Mild Shock schrieb:
> Just watched 2 videos from Scala and the
> year 2023 and nearly chocked on my yoghurt,
>
> especially when I saw the first presenter got a
> headeache from early returns. LoL
>
> Async/Await for the Monadic Programmer
> https://www.youtube.com/watch?v=OH5cxLNTTPo
>
> DIRECT STYLE SCALA Scalar Conference 2023
> https://www.youtube.com/watch?v=0Fm0y4K4YO8
>
> Whats the bottom line: All because they discovered they
> could do async/await as well?

Re: Not being a Haskell programmer is trendy!

<urt0rj$qgjc$2@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10299&group=comp.lang.prolog#10299

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Fri, 1 Mar 2024 17:47:47 +0100
Message-ID: <urt0rj$qgjc$2@solani.org>
References: <upjgq3$19qjv$1@solani.org> <urt0n0$qgjc$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Mar 2024 16:47:48 -0000 (UTC)
Injection-Info: solani.org;
logging-data="868972"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:Oo4kgJ3xwoNsqP4o1yny7ExiAtg=
In-Reply-To: <urt0n0$qgjc$1@solani.org>
X-User-ID: eJwNysEBwCAIA8CVaIUA4xDB/UfQe58tfNiuMKgdO+OVPumMTo5MM1yapDARhb+dO1oKy94Gaqlvizr6avcFfxkWzA==
 by: Mild Shock - Fri, 1 Mar 2024 16:47 UTC

Motivation, it is now widespread assume that
Prolog has call/n. But testing shows that both
Scryer Prolog and Trealla Prolog chocke even on

call/1. But then we find this proposal which
includes maplist/n, foldl/4, etc..

A Prologue for Prolog - post-N290
https://www.complang.tuwien.ac.at/ulrich/iso-prolog/prologue

But is there a Prolog technology that makes
call/n fast in the first place?

Mild Shock schrieb:
>
> Can the golang interfaces handling be compared to lazy/sharing
> in the non-strict semantics of Haskell? Just curious, maybe
> there is nevertheless a chance to speed up Prolog call/n.
>
> After all Haskell and Prolog are very similar they champion
> non-strict features. Most novice Prolog programmers are
> suprised by this behaviour, and that they need to invoke is/2,
>
> making evaluation explicit, why is it not implicit like in every
> other programming language (warning the example could
> be misleading, its not what I am attacking, only motivation here):
>
> ?- X = 1+2.
> X = 1+2
>
> But then there are other more important corner where Prolog
> and Haskell are basically the same, i.e. call/n.
>
> The sharing in Haskell could then give semantic to monomorphic
> and polymorphic caches. Did somebody write a paper about
> golang interfaces handling, relating it to non-strict behaviour?
>
>
> Mild Shock schrieb:
>> Just watched 2 videos from Scala and the
>> year 2023 and nearly chocked on my yoghurt,
>>
>> especially when I saw the first presenter got a
>> headeache from early returns. LoL
>>
>> Async/Await for the Monadic Programmer
>> https://www.youtube.com/watch?v=OH5cxLNTTPo
>>
>> DIRECT STYLE SCALA Scalar Conference 2023
>> https://www.youtube.com/watch?v=0Fm0y4K4YO8
>>
>> Whats the bottom line: All because they discovered they
>> could do async/await as well?
>

Re: Not being a Haskell programmer is trendy!

<urt1dd$qh1v$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10300&group=comp.lang.prolog#10300

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Fri, 1 Mar 2024 17:57:17 +0100
Message-ID: <urt1dd$qh1v$1@solani.org>
References: <upjgq3$19qjv$1@solani.org> <urt0n0$qgjc$1@solani.org>
<urt0rj$qgjc$2@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Mar 2024 16:57:17 -0000 (UTC)
Injection-Info: solani.org;
logging-data="869439"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:mReUYc64mi9BJgkXAhiDpuUmt5Y=
X-User-ID: eJwNyMEBwCAIA8CVBJJQxqmC+4/Q3vMYMp2EKPDyutx8j6JA3lOPAMHMPIfZmJPebJ+FvVL/W6GYTMRbqz8UPhOK
In-Reply-To: <urt0rj$qgjc$2@solani.org>
 by: Mild Shock - Fri, 1 Mar 2024 16:57 UTC

BTW: I retract my claim that Trealla Prolog
chokes on call/1. This is amazing. Try this program:

?- [user].
p(X) :- X = (Y is 1+2, _ is Y+3).

First SWI-Prolog:

/* SWI-Prolog */
?- p(X), time((between(1,1000000,_),call(X),fail; true)).
% 2,999,998 inferences, 0.516 CPU in 0.508 seconds (101% CPU, 5818178 Lips)
X = (_A is 1+2, _ is _A+3).

?- time((between(1,1000000,_),p(X),call(X),fail; true)).
% 3,999,998 inferences, 0.594 CPU in 0.580 seconds (102% CPU, 6736839 Lips)

Then Trealla Prolog:

?- p(X), time((between(1,1000000,_),X,fail; true)).
% Time elapsed 0.244s, 4000003 Inferences, 16.363 MLips
X = (_A is 1+2,_B is _A+3).

?- time((between(1,1000000,_),p(X),X,fail; true)).
% Time elapsed 0.399s, 6000003 Inferences, 15.047 MLips
true.

Whats going on, why is it faster?

Mild Shock schrieb:
>
> Motivation, it is now widespread assume that
> Prolog has call/n. But testing shows that both
> Scryer Prolog and Trealla Prolog chocke even on
>
> call/1. But then we find this proposal which
> includes maplist/n, foldl/4, etc..
>
> A Prologue for Prolog - post-N290
> https://www.complang.tuwien.ac.at/ulrich/iso-prolog/prologue
>
> But is there a Prolog technology that makes
> call/n fast in the first place?
>
>
> Mild Shock schrieb:
>>
>> Can the golang interfaces handling be compared to lazy/sharing
>> in the non-strict semantics of Haskell? Just curious, maybe
>> there is nevertheless a chance to speed up Prolog call/n.
>>
>> After all Haskell and Prolog are very similar they champion
>> non-strict features. Most novice Prolog programmers are
>> suprised by this behaviour, and that they need to invoke is/2,
>>
>> making evaluation explicit, why is it not implicit like in every
>> other programming language (warning the example could
>> be misleading, its not what I am attacking, only motivation here):
>>
>> ?- X = 1+2.
>> X = 1+2
>>
>> But then there are other more important corner where Prolog
>> and Haskell are basically the same, i.e. call/n.
>>
>> The sharing in Haskell could then give semantic to monomorphic
>> and polymorphic caches. Did somebody write a paper about
>> golang interfaces handling, relating it to non-strict behaviour?
>>
>>
>> Mild Shock schrieb:
>>> Just watched 2 videos from Scala and the
>>> year 2023 and nearly chocked on my yoghurt,
>>>
>>> especially when I saw the first presenter got a
>>> headeache from early returns. LoL
>>>
>>> Async/Await for the Monadic Programmer
>>> https://www.youtube.com/watch?v=OH5cxLNTTPo
>>>
>>> DIRECT STYLE SCALA Scalar Conference 2023
>>> https://www.youtube.com/watch?v=0Fm0y4K4YO8
>>>
>>> Whats the bottom line: All because they discovered they
>>> could do async/await as well?
>>
>

Re: Not being a Haskell programmer is trendy!

<urt1tr$qhcg$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10301&group=comp.lang.prolog#10301

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Fri, 1 Mar 2024 18:06:02 +0100
Message-ID: <urt1tr$qhcg$1@solani.org>
References: <upjgq3$19qjv$1@solani.org> <urt0n0$qgjc$1@solani.org>
<urt0rj$qgjc$2@solani.org> <urt1dd$qh1v$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 1 Mar 2024 17:06:03 -0000 (UTC)
Injection-Info: solani.org;
logging-data="869776"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:JKOQDZxmfQrnJeSqCXz6kfxzWO8=
In-Reply-To: <urt1dd$qh1v$1@solani.org>
X-User-ID: eJwFwYEBwDAEBMCVCF6M46X2H6F3YVBMOgIeG4tbU/j6cCZF8uJoNr3DnEwJ64seHlueHLqusl6+gn5i9QNNaRVc
 by: Mild Shock - Fri, 1 Mar 2024 17:06 UTC

I can make the first test case faster in SWI-Prolog
by removing the call/1. but it doesn't have an impact
on the second test case:

?- p(X), time((between(1,1000000,_),X,fail; true)).
% 2,999,998 inferences, 0.172 CPU in 0.183 seconds (94% CPU, 17454534 Lips)
X = (_A is 1+2, _ is _A+3).

?- time((between(1,1000000,_),p(X),X,fail; true)).
% 3,999,998 inferences, 0.594 CPU in 0.597 seconds (99% CPU, 6736839 Lips)
true.

Now I am testing the same for SWI-Prolog and Trealla
Prolog. SWI-Prolog has it an itch faster in the first
test case, but an itch slower in the second test case.

Mild Shock schrieb:
>
> BTW: I retract my claim that Trealla Prolog
> chokes on call/1. This is amazing. Try this program:
>
> ?- [user].
> p(X) :- X = (Y is 1+2, _ is Y+3).
>
> First SWI-Prolog:
>
> /* SWI-Prolog */
> ?- p(X), time((between(1,1000000,_),call(X),fail; true)).
> % 2,999,998 inferences, 0.516 CPU in 0.508 seconds (101% CPU, 5818178 Lips)
> X = (_A is 1+2, _ is _A+3).
>
> ?- time((between(1,1000000,_),p(X),call(X),fail; true)).
> % 3,999,998 inferences, 0.594 CPU in 0.580 seconds (102% CPU, 6736839 Lips)
>
> Then Trealla Prolog:
>
> ?- p(X), time((between(1,1000000,_),X,fail; true)).
> % Time elapsed 0.244s, 4000003 Inferences, 16.363 MLips
>    X = (_A is 1+2,_B is _A+3).
>
> ?- time((between(1,1000000,_),p(X),X,fail; true)).
> % Time elapsed 0.399s, 6000003 Inferences, 15.047 MLips
>    true.
>
> Whats going on, why is it faster?
>
> Mild Shock schrieb:
>>
>> Motivation, it is now widespread assume that
>> Prolog has call/n. But testing shows that both
>> Scryer Prolog and Trealla Prolog chocke even on
>>
>> call/1. But then we find this proposal which
>> includes maplist/n, foldl/4, etc..
>>
>> A Prologue for Prolog - post-N290
>> https://www.complang.tuwien.ac.at/ulrich/iso-prolog/prologue
>>
>> But is there a Prolog technology that makes
>> call/n fast in the first place?
>>
>>
>> Mild Shock schrieb:
>>>
>>> Can the golang interfaces handling be compared to lazy/sharing
>>> in the non-strict semantics of Haskell? Just curious, maybe
>>> there is nevertheless a chance to speed up Prolog call/n.
>>>
>>> After all Haskell and Prolog are very similar they champion
>>> non-strict features. Most novice Prolog programmers are
>>> suprised by this behaviour, and that they need to invoke is/2,
>>>
>>> making evaluation explicit, why is it not implicit like in every
>>> other programming language (warning the example could
>>> be misleading, its not what I am attacking, only motivation here):
>>>
>>> ?- X = 1+2.
>>> X = 1+2
>>>
>>> But then there are other more important corner where Prolog
>>> and Haskell are basically the same, i.e. call/n.
>>>
>>> The sharing in Haskell could then give semantic to monomorphic
>>> and polymorphic caches. Did somebody write a paper about
>>> golang interfaces handling, relating it to non-strict behaviour?
>>>
>>>
>>> Mild Shock schrieb:
>>>> Just watched 2 videos from Scala and the
>>>> year 2023 and nearly chocked on my yoghurt,
>>>>
>>>> especially when I saw the first presenter got a
>>>> headeache from early returns. LoL
>>>>
>>>> Async/Await for the Monadic Programmer
>>>> https://www.youtube.com/watch?v=OH5cxLNTTPo
>>>>
>>>> DIRECT STYLE SCALA Scalar Conference 2023
>>>> https://www.youtube.com/watch?v=0Fm0y4K4YO8
>>>>
>>>> Whats the bottom line: All because they discovered they
>>>> could do async/await as well?
>>>
>>
>

Re: Not being a Haskell programmer is trendy!

<urt22u$qhcg$2@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10302&group=comp.lang.prolog#10302

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Fri, 1 Mar 2024 18:08:46 +0100
Message-ID: <urt22u$qhcg$2@solani.org>
References: <upjgq3$19qjv$1@solani.org> <urt0n0$qgjc$1@solani.org>
<urt0rj$qgjc$2@solani.org> <urt1dd$qh1v$1@solani.org>
<urt1tr$qhcg$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 1 Mar 2024 17:08:47 -0000 (UTC)
Injection-Info: solani.org;
logging-data="869776"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:9jdn8TyaUhQGFogKRhFl4HneMZM=
X-User-ID: eJwFwYEBwCAIA7CXLFjQc4SV/09YQg9E5w7G5nCy9FBLfVRPccll9DO4qlR+qtmY9xnpJkuaGukIWh+HfnQwFb8=
In-Reply-To: <urt1tr$qhcg$1@solani.org>
 by: Mild Shock - Fri, 1 Mar 2024 17:08 UTC

But I cannot retract my claim about Scryer Prolog
it definitively chokes:

?- p(X), time((between(1,1000000,_),X,fail; true)).
% CPU time: 2.233s, 11_000_023 inferences
X = (_A is 1+2,_B is _A+3).

?- time((between(1,1000000,_),p(X),X,fail; true)).
% CPU time: 6.180s, 13_000_045 inferences
true.

Thats an order slower than Trealla and SWI-Prolog.

Mild Shock schrieb:
> I can make the first test case faster in SWI-Prolog
> by removing the call/1. but it doesn't have an impact
> on the second test case:
>
> ?- p(X), time((between(1,1000000,_),X,fail; true)).
> % 2,999,998 inferences, 0.172 CPU in 0.183 seconds (94% CPU, 17454534 Lips)
> X = (_A is 1+2, _ is _A+3).
>
> ?- time((between(1,1000000,_),p(X),X,fail; true)).
> % 3,999,998 inferences, 0.594 CPU in 0.597 seconds (99% CPU, 6736839 Lips)
> true.
>
> Now I am testing the same for SWI-Prolog and Trealla
> Prolog. SWI-Prolog has it an itch faster in the first
> test case, but an itch slower in the second test case.
>
> Mild Shock schrieb:
>>
>> BTW: I retract my claim that Trealla Prolog
>> chokes on call/1. This is amazing. Try this program:
>>
>> ?- [user].
>> p(X) :- X = (Y is 1+2, _ is Y+3).
>>
>> First SWI-Prolog:
>>
>> /* SWI-Prolog */
>> ?- p(X), time((between(1,1000000,_),call(X),fail; true)).
>> % 2,999,998 inferences, 0.516 CPU in 0.508 seconds (101% CPU, 5818178
>> Lips)
>> X = (_A is 1+2, _ is _A+3).
>>
>> ?- time((between(1,1000000,_),p(X),call(X),fail; true)).
>> % 3,999,998 inferences, 0.594 CPU in 0.580 seconds (102% CPU, 6736839
>> Lips)
>>
>> Then Trealla Prolog:
>>
>> ?- p(X), time((between(1,1000000,_),X,fail; true)).
>> % Time elapsed 0.244s, 4000003 Inferences, 16.363 MLips
>>     X = (_A is 1+2,_B is _A+3).
>>
>> ?- time((between(1,1000000,_),p(X),X,fail; true)).
>> % Time elapsed 0.399s, 6000003 Inferences, 15.047 MLips
>>     true.
>>
>> Whats going on, why is it faster?
>>
>> Mild Shock schrieb:
>>>
>>> Motivation, it is now widespread assume that
>>> Prolog has call/n. But testing shows that both
>>> Scryer Prolog and Trealla Prolog chocke even on
>>>
>>> call/1. But then we find this proposal which
>>> includes maplist/n, foldl/4, etc..
>>>
>>> A Prologue for Prolog - post-N290
>>> https://www.complang.tuwien.ac.at/ulrich/iso-prolog/prologue
>>>
>>> But is there a Prolog technology that makes
>>> call/n fast in the first place?
>>>
>>>
>>> Mild Shock schrieb:
>>>>
>>>> Can the golang interfaces handling be compared to lazy/sharing
>>>> in the non-strict semantics of Haskell? Just curious, maybe
>>>> there is nevertheless a chance to speed up Prolog call/n.
>>>>
>>>> After all Haskell and Prolog are very similar they champion
>>>> non-strict features. Most novice Prolog programmers are
>>>> suprised by this behaviour, and that they need to invoke is/2,
>>>>
>>>> making evaluation explicit, why is it not implicit like in every
>>>> other programming language (warning the example could
>>>> be misleading, its not what I am attacking, only motivation here):
>>>>
>>>> ?- X = 1+2.
>>>> X = 1+2
>>>>
>>>> But then there are other more important corner where Prolog
>>>> and Haskell are basically the same, i.e. call/n.
>>>>
>>>> The sharing in Haskell could then give semantic to monomorphic
>>>> and polymorphic caches. Did somebody write a paper about
>>>> golang interfaces handling, relating it to non-strict behaviour?
>>>>
>>>>
>>>> Mild Shock schrieb:
>>>>> Just watched 2 videos from Scala and the
>>>>> year 2023 and nearly chocked on my yoghurt,
>>>>>
>>>>> especially when I saw the first presenter got a
>>>>> headeache from early returns. LoL
>>>>>
>>>>> Async/Await for the Monadic Programmer
>>>>> https://www.youtube.com/watch?v=OH5cxLNTTPo
>>>>>
>>>>> DIRECT STYLE SCALA Scalar Conference 2023
>>>>> https://www.youtube.com/watch?v=0Fm0y4K4YO8
>>>>>
>>>>> Whats the bottom line: All because they discovered they
>>>>> could do async/await as well?
>>>>
>>>
>>
>

Re: Not being a Haskell programmer is trendy!

<urt7ol$qkts$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10303&group=comp.lang.prolog#10303

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Fri, 1 Mar 2024 19:45:42 +0100
Message-ID: <urt7ol$qkts$1@solani.org>
References: <upjgq3$19qjv$1@solani.org> <urt0n0$qgjc$1@solani.org>
<urt0rj$qgjc$2@solani.org> <urt1dd$qh1v$1@solani.org>
<urt1tr$qhcg$1@solani.org> <urt22u$qhcg$2@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 1 Mar 2024 18:45:41 -0000 (UTC)
Injection-Info: solani.org;
logging-data="873404"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:CnezbEPLTIV0myn+5eGvjAmVpiY=
X-User-ID: eJwFwYEBwDAEBMCVwvN0HCT2H6F3DgonjE7z9Y1axxm02hHNtKC3nC97Psbr1UY9FjjbFzNXxav96cWNxA9GOhW1
In-Reply-To: <urt22u$qhcg$2@solani.org>
 by: Mild Shock - Fri, 1 Mar 2024 18:45 UTC

A small sanity test. How does formerly Jekejeke Prolog
and Dogelog Player perform. Dogelog Player has not yet
call/N, I do not promote using it, since I am

still waiting for a good idea to compile it a little
bit more statically. Formerly Jekejeke Prolog uses a
dynamic inline cache, polymorphic in the arity.

But this test case is anyway less about call/N and
more about call/1 and is/2. I get:

For formerly Jekejeke Prolog:

/* Jekejeke Prolog 1.6.6 */
?- p(X), time((between(1,1000000,_),X,fail; true)).
% Zeit 540 ms, GC 3 ms, Uhr 01.03.2024 19:37
X = (_0 is 1+2, _1 is _0+3).

?- time((between(1,1000000,_),p(X),X,fail; true)).
% Zeit 867 ms, GC 3 ms, Uhr 01.03.2024 19:37
true.

For Dogelog Player:

/* Dogelog Player 1.1.6 */
?- p(X), time((between(1,1000000,_),X,fail; true)).
% Zeit 447 ms, GC 0 ms, Lips 15660199, Uhr 01.03.2024 19:38
X = (_16030782 is 1+2, _16030783 is _16030782+3).

?- time((between(1,1000000,_),p(X),X,fail; true)).
% Zeit 1780 ms, GC 0 ms, Lips 14606802, Uhr 01.03.2024 19:38
true.

Jekejeke Prolog and Dogelog Player do not choke
like Scryer Prolog does. The performance of Dogelog
Player is amazing, since call/1 is implemented in

pure Prolog, not via an interpreter, but via a little
compiler, and an intermediate form, that we anyway use
when we generate cross compiled code or

static/dynamic clausse.

Mild Shock schrieb:
> But I cannot retract my claim about Scryer Prolog
> it definitively chokes:
>
> ?- p(X), time((between(1,1000000,_),X,fail; true)).
>    % CPU time: 2.233s, 11_000_023 inferences
>    X = (_A is 1+2,_B is _A+3).
>
> ?- time((between(1,1000000,_),p(X),X,fail; true)).
>    % CPU time: 6.180s, 13_000_045 inferences
>    true.
>
> Thats an order slower than Trealla and SWI-Prolog.
>

Re: Not being a Haskell programmer is trendy!

<urte2c$qgfe$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10304&group=comp.lang.prolog#10304

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Fri, 1 Mar 2024 21:33:17 +0100
Message-ID: <urte2c$qgfe$1@solani.org>
References: <upjgq3$19qjv$1@solani.org> <urt0n0$qgjc$1@solani.org>
<urt0rj$qgjc$2@solani.org> <urt1dd$qh1v$1@solani.org>
<urt1tr$qhcg$1@solani.org> <urt22u$qhcg$2@solani.org>
<urt7ol$qkts$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 1 Mar 2024 20:33:17 -0000 (UTC)
Injection-Info: solani.org;
logging-data="868846"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:KoHQtt7+ac+tzDlH/RPeEWCEuuk=
In-Reply-To: <urt7ol$qkts$1@solani.org>
X-User-ID: eJwFwYEBwCAIA7CXRAvMc6DF/09Y4icsmAgP+POXPtjvy9atWpUHYrOaRFzSfOzommGGWyPUan3O1nborh9/rRbQ
 by: Mild Shock - Fri, 1 Mar 2024 20:33 UTC

Lets not forget GNU Prolog. It lacks a little bit
behind SWI-Prolog for the first test case:

?- p(X), (between(1,1000000,_),X,fail; true).
X = (A is 1+2,_ is A+3)
(453 ms) yes

?- (between(1,1000000,_),p(X),X,fail; true).
(578 ms) yes

Also this kind of testing might be a little bit
to generous, by ommiting the time/1 call.

Mild Shock schrieb:
> A small sanity test. How does formerly Jekejeke Prolog
> and Dogelog Player perform. Dogelog Player has not yet
> call/N, I do not promote using it, since I am
>
> still waiting for a good idea to compile it a little
> bit more statically. Formerly Jekejeke Prolog uses a
> dynamic inline cache, polymorphic in the arity.
>
> But this test case is anyway less about call/N and
> more about call/1 and is/2. I get:
>
> For formerly Jekejeke Prolog:
>
> /* Jekejeke Prolog 1.6.6 */
> ?- p(X), time((between(1,1000000,_),X,fail; true)).
> % Zeit 540 ms, GC 3 ms, Uhr 01.03.2024 19:37
> X = (_0 is 1+2, _1 is _0+3).
>
> ?- time((between(1,1000000,_),p(X),X,fail; true)).
> % Zeit 867 ms, GC 3 ms, Uhr 01.03.2024 19:37
> true.
>
> For Dogelog Player:
>
> /* Dogelog Player 1.1.6 */
> ?- p(X), time((between(1,1000000,_),X,fail; true)).
> % Zeit 447 ms, GC 0 ms, Lips 15660199, Uhr 01.03.2024 19:38
> X = (_16030782 is 1+2, _16030783 is _16030782+3).
>
> ?- time((between(1,1000000,_),p(X),X,fail; true)).
> % Zeit 1780 ms, GC 0 ms, Lips 14606802, Uhr 01.03.2024 19:38
> true.
>
> Jekejeke Prolog and Dogelog Player do not choke
> like Scryer Prolog does. The performance of Dogelog
> Player is amazing, since call/1 is implemented in
>
> pure Prolog, not via an interpreter, but via a little
> compiler, and an intermediate form, that we anyway use
> when we generate cross compiled code or
>
> static/dynamic clausse.
>
> Mild Shock schrieb:
>> But I cannot retract my claim about Scryer Prolog
>> it definitively chokes:
>>
>> ?- p(X), time((between(1,1000000,_),X,fail; true)).
>>     % CPU time: 2.233s, 11_000_023 inferences
>>     X = (_A is 1+2,_B is _A+3).
>>
>> ?- time((between(1,1000000,_),p(X),X,fail; true)).
>>     % CPU time: 6.180s, 13_000_045 inferences
>>     true.
>>
>> Thats an order slower than Trealla and SWI-Prolog.
>>
>
>

Re: Not being a Haskell programmer is trendy!

<us8f0r$100qa$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10308&group=comp.lang.prolog#10308

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janbu...@fastmail.fm (Mild Shock)
Newsgroups: comp.lang.prolog
Subject: Re: Not being a Haskell programmer is trendy!
Date: Wed, 6 Mar 2024 01:56:59 +0100
Message-ID: <us8f0r$100qa$1@solani.org>
References: <upjgq3$19qjv$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 6 Mar 2024 00:56:59 -0000 (UTC)
Injection-Info: solani.org;
logging-data="1049418"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:xBDIqw7IKCFIt6TBHYbkQwHb12c=
In-Reply-To: <upjgq3$19qjv$1@solani.org>
X-User-ID: eJwFwYEBwCAIA7CXRNui5wCD/09YwiNTOUSBwylFr7jjOfF8GQTn7dnIXqPMU6P3EVhh+yBfk+HXwqmS/2NvFW0=
 by: Mild Shock - Wed, 6 Mar 2024 00:56 UTC

In short moment I though I could speed up
call/1, by using SWI-Prolog $meta_call/1 semantics,
which differs from call/1 semantis:

/* SWI-Prolog 9.3.0 */
?- call((Y=!,(X=1;X=2),Y,X=2)).
Y = !,
X = 2.

?- '$meta_call'((Y=!,(X=1;X=2),Y,X=2)).
false.

/* SWI-Prolog 9.3.0 */
?- call(((X=1;X=2),1,X=2)).
ERROR: Type error: `callable' expected, found
`(_168=1;_168=2),1,_168=2' (a compound)

?- '$meta_call'(((X=1;X=2),1,X=2)).
ERROR: Type error: `callable' expected, found `1' (an integer)

One can spare one pass, since body conversion is
ommited. Would make call/1 faster. Also intersting
find, that I wasn't aware of, namely there is

correspondence between:

SWI-Prolog Dogelog Player
prolog_current_choice/1 '$MARK'
prolog_cut_to/1 '$CUT'

but the body conversion pass in Dogelog Player, does
optimize away unnecessary '$MARK' and $CUT', so maybe
the this extra pass isn't useless overhead?

Mild Shock schrieb:
> Lets not forget GNU Prolog. It lacks a little bit
> behind SWI-Prolog for the first test case:
>
> ?- p(X), (between(1,1000000,_),X,fail; true).
> X = (A is 1+2,_ is A+3)
> (453 ms) yes
>
> ?- (between(1,1000000,_),p(X),X,fail; true).
> (578 ms) yes
>
> Also this kind of testing might be a little bit
> to generous, by ommiting the time/1 call.


devel / comp.lang.prolog / Re: Not being a Haskell programmer is trendy!

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor