Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.prolog > #14001

Re: Not being a Haskell programmer is trendy!

From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.prolog
Subject Re: Not being a Haskell programmer is trendy!
Date 2024-03-01 18:08 +0100
Message-ID <urt22u$qhcg$2@solani.org> (permalink)
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>

Show all headers | View raw


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?
>>>>
>>>
>>
> 

Back to comp.lang.prolog | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-02-02 20:46 +0100
  Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-02-02 21:00 +0100
    Re: Not being a Haskell programmer is trendy! Mild Shock <bursejan@gmail.com> - 2024-02-02 12:50 -0800
      Re: Not being a Haskell programmer is trendy! Mild Shock <bursejan@gmail.com> - 2024-02-07 03:25 -0800
    Re: Not being a Haskell programmer is trendy! Mild Shock <bursejan@gmail.com> - 2024-02-11 14:34 -0800
      Re: Not being a Haskell programmer is trendy! Mild Shock <bursejan@gmail.com> - 2024-02-11 14:39 -0800
        Re: Not being a Haskell programmer is trendy! Mild Shock <bursejan@gmail.com> - 2024-02-14 06:45 -0800
          Re: Not being a Haskell programmer is trendy! Mild Shock <bursejan@gmail.com> - 2024-02-14 06:53 -0800
  Re: Not being a Haskell programmer is trendy! Mild Shock <bursejan@gmail.com> - 2024-02-14 13:29 -0800
    Re: Not being a Haskell programmer is trendy! Mild Shock <bursejan@gmail.com> - 2024-02-14 13:33 -0800
  Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-02-21 01:27 +0100
    Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-02-21 01:28 +0100
      Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-02-21 01:30 +0100
        Re: Not being a Haskell programmer is trendy! Mild Shock <bursejan@gmail.com> - 2024-02-21 03:43 -0800
  Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-03-01 17:45 +0100
    Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-03-01 17:47 +0100
      Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-03-01 17:57 +0100
        Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-03-01 18:06 +0100
          Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-03-01 18:08 +0100
            Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-03-01 19:45 +0100
              Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-03-01 21:33 +0100
  Re: Not being a Haskell programmer is trendy! Mild Shock <janburse@fastmail.fm> - 2024-03-06 01:56 +0100

csiph-web