Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"History is a tool used by politicians to justify their intentions." -- Ted Koppel


devel / comp.lang.forth / Re: SEND+MORE=MONEY

SubjectAuthor
* SEND+MORE=MONEYminf...@arcor.de
+* Re: SEND+MORE=MONEYJali Heinonen
|`* Re: SEND+MORE=MONEYJali Heinonen
| `* Re: SEND+MORE=MONEYminf...@arcor.de
|  `- Re: SEND+MORE=MONEYGerry Jackson
+- Re: SEND+MORE=MONEYMarcel Hendrix
+* Re: SEND+MORE=MONEYMarcel Hendrix
|`* Re: SEND+MORE=MONEYminf...@arcor.de
| +* Re: SEND+MORE=MONEYMarcel Hendrix
| |`- Re: SEND+MORE=MONEYminf...@arcor.de
| `* Re: SEND+MORE=MONEYAnton Ertl
|  `* Re: SEND+MORE=MONEYminf...@arcor.de
|   `- Re: SEND+MORE=MONEYminf...@arcor.de
+* Re: SEND+MORE=MONEYAnton Ertl
|+- Re: SEND+MORE=MONEYAnton Ertl
|`* Re: SEND+MORE=MONEYMarcel Hendrix
| `- Re: SEND+MORE=MONEYAnton Ertl
+* Re: SEND+MORE=MONEYPaul Rubin
|`* Re: SEND+MORE=MONEYAnton Ertl
| +* Re: SEND+MORE=MONEYJali Heinonen
| |+- Re: SEND+MORE=MONEYAnton Ertl
| |`- Re: SEND+MORE=MONEYPaul Rubin
| +* Re: SEND+MORE=MONEYminf...@arcor.de
| |`* Re: SEND+MORE=MONEYAnton Ertl
| | +- locals slowness in sf and vfx (was: SEND+MORE=MONEY)Anton Ertl
| | `* Re: SEND+MORE=MONEYnone
| |  +* Re: SEND+MORE=MONEYminf...@arcor.de
| |  |`* Re: SEND+MORE=MONEYAla'a
| |  | `* Re: SEND+MORE=MONEYMarcel Hendrix
| |  |  `* Re: SEND+MORE=MONEYAla'a
| |  |   `* Re: SEND+MORE=MONEYMarcel Hendrix
| |  |    +* Re: SEND+MORE=MONEYAla'a
| |  |    |`* Re: SEND+MORE=MONEYMarcel Hendrix
| |  |    | `* Re: SEND+MORE=MONEYMarcel Hendrix
| |  |    |  `* Re: SEND+MORE=MONEYAla'a
| |  |    |   `- Re: SEND+MORE=MONEYminf...@arcor.de
| |  |    `- Re: SEND+MORE=MONEYdxforth
| |  `- Re: SEND+MORE=MONEYAnton Ertl
| `* Re: SEND+MORE=MONEYPaul Rubin
|  `* Re: SEND+MORE=MONEYPaul Rubin
|   +* Re: SEND+MORE=MONEYminf...@arcor.de
|   |`- Re: SEND+MORE=MONEYPaul Rubin
|   +- Re: SEND+MORE=MONEYPaul Rubin
|   `* Re: SEND+MORE=MONEYAnton Ertl
|    +- Re: SEND+MORE=MONEYPaul Rubin
|    `* Re: SEND+MORE=MONEYPaul Rubin
|     `* Re: SEND+MORE=MONEYminf...@arcor.de
|      `* Re: SEND+MORE=MONEYGerry Jackson
|       +* Re: SEND+MORE=MONEYPaul Rubin
|       |+- Re: SEND+MORE=MONEYdxforth
|       |`- Re: SEND+MORE=MONEYminf...@arcor.de
|       `* Re: SEND+MORE=MONEYMarcel Hendrix
|        `* Re: SEND+MORE=MONEYminf...@arcor.de
|         +* Re: SEND+MORE=MONEYMarcel Hendrix
|         |`* Re: SEND+MORE=MONEYdxforth
|         | `- Re: SEND+MORE=MONEYMarcel Hendrix
|         `* Re: SEND+MORE=MONEYminf...@arcor.de
|          +* Re: SEND+MORE=MONEYMarcel Hendrix
|          |`* Re: SEND+MORE=MONEYHans Bezemer
|          | +* Re: SEND+MORE=MONEYminf...@arcor.de
|          | |`- Re: SEND+MORE=MONEYHans Bezemer
|          | +* Re: SEND+MORE=MONEYMarcel Hendrix
|          | |`- Re: SEND+MORE=MONEYdxforth
|          | `* Re: SEND+MORE=MONEYMarcel Hendrix
|          |  `* Re: SEND+MORE=MONEYHans Bezemer
|          |   `* Re: SEND+MORE=MONEYMarcel Hendrix
|          |    `* Re: SEND+MORE=MONEYHans Bezemer
|          |     `- Re: SEND+MORE=MONEYBrian Fox
|          `* Re: SEND+MORE=MONEYdxforth
|           +* Re: SEND+MORE=MONEYminf...@arcor.de
|           |`* Re: SEND+MORE=MONEYMarcel Hendrix
|           | +* Re: SEND+MORE=MONEYminf...@arcor.de
|           | |+- Re: SEND+MORE=MONEYMarcel Hendrix
|           | |`* Re: SEND+MORE=MONEYAnton Ertl
|           | | +* Re: SEND+MORE=MONEYminf...@arcor.de
|           | | |`- Re: SEND+MORE=MONEYHans Bezemer
|           | | `* Re: SEND+MORE=MONEYminf...@arcor.de
|           | |  `* Re: SEND+MORE=MONEYAnton Ertl
|           | |   `- Re: SEND+MORE=MONEYminf...@arcor.de
|           | +- Re: SEND+MORE=MONEYMarcel Hendrix
|           | `* Re: SEND+MORE=MONEYHans Bezemer
|           |  `* Re: SEND+MORE=MONEYMarcel Hendrix
|           |   +* Re: SEND+MORE=MONEYHans Bezemer
|           |   |`* Re: SEND+MORE=MONEYMarcel Hendrix
|           |   | `* Re: SEND+MORE=MONEYAnton Ertl
|           |   |  `- Re: SEND+MORE=MONEYMarcel Hendrix
|           |   `* Re: SEND+MORE=MONEYminf...@arcor.de
|           |    `- Re: SEND+MORE=MONEYMarcel Hendrix
|           `- Re: SEND+MORE=MONEYdxforth
+* Re: SEND+MORE=MONEYAhmed MELAHI
|`* Re: SEND+MORE=MONEYminf...@arcor.de
| `* Re: SEND+MORE=MONEYAhmed MELAHI
|  +* Re: SEND+MORE=MONEYAhmed MELAHI
|  |`- Re: SEND+MORE=MONEYAhmed MELAHI
|  `* Re: SEND+MORE=MONEYminf...@arcor.de
|   +- Re: SEND+MORE=MONEYJali Heinonen
|   +* Re: SEND+MORE=MONEYAhmed MELAHI
|   |`- Re: SEND+MORE=MONEYAhmed MELAHI
|   +* Re: SEND+MORE=MONEYAnton Ertl
|   |`* Re: SEND+MORE=MONEYminf...@arcor.de
|   | `- Re: SEND+MORE=MONEYAnton Ertl
|   +- Re: SEND+MORE=MONEYAhmed MELAHI
|   `* Re: SEND+MORE=MONEYAhmed MELAHI
`- Re: SEND+MORE=MONEYNN

Pages:12345
Re: SEND+MORE=MONEY

<02ddb9a9-880e-4ba7-b884-d0c0d837049fn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:9cc5:0:b0:56e:1d81:71b9 with SMTP id j5-20020a0c9cc5000000b0056e1d8171b9mr71598qvf.55.1675948628495;
Thu, 09 Feb 2023 05:17:08 -0800 (PST)
X-Received: by 2002:a0d:c442:0:b0:527:b471:cac7 with SMTP id
g63-20020a0dc442000000b00527b471cac7mr1231805ywd.489.1675948628234; Thu, 09
Feb 2023 05:17:08 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 9 Feb 2023 05:17:07 -0800 (PST)
In-Reply-To: <7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=154.121.48.163; posting-account=KJSw4AoAAACRkUCek5r_78mFj6sHzH4C
NNTP-Posting-Host: 154.121.48.163
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<787c9189-9528-4a55-8462-8e924c68ff7cn@googlegroups.com> <7f3b51ea-1680-4d80-890b-28ac718d288fn@googlegroups.com>
<7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <02ddb9a9-880e-4ba7-b884-d0c0d837049fn@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: ahmed.me...@univ-bejaia.dz (Ahmed MELAHI)
Injection-Date: Thu, 09 Feb 2023 13:17:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 10930
 by: Ahmed MELAHI - Thu, 9 Feb 2023 13:17 UTC

Le jeudi 9 février 2023 à 12:47:02 UTC, Ahmed MELAHI a écrit :
> Le jeudi 9 février 2023 à 08:13:20 UTC, minf...@arcor.de a écrit :
> > Ahmed MELAHI schrieb am Donnerstag, 9. Februar 2023 um 09:00:14 UTC+1:
> > > > SENDMOREMONEY
> > > Hi everybody,
> > > Here is a program that gives all possible solutions (there are 25), written in gforth.
> > Thanks! 25 solutions appear when M is allowed to be zero.
> > Even more solutions appear when the all-digits-different constraint is taken out.
> >
> > I am fascinated by those many completely different approaches in this thread.
> Hi,
> For the case of m<>0 (so m must be 1), the same program gives the also the unique result, by selecting the solution with m=1.
>
> To get the unique result directly,one can set 1 to m, and search for the others.
> Here is the program (the same as the previous, with some changes)
> s" random.fs" included
>
> : not 0= ;
>
> 0 value s
> 0 value e
> 0 value n
> 0 value d
> 0 value m
> 0 value o
> 0 value r
> 0 value y
>
> : send s 10 * e + 10 * n + 10 * d + ;
> : more m 10 * o + 10 * r + 10 * e + ;
> : money m 10 * o + 10 * n + 10 * e + 10 * y + ;
>
> : is_send+more=money_? send more + money - 0= ;
>
> create flags_chosen_vals 10 allot
> flags_chosen_vals 10 erase
>
> create flags_chosen_sendmory 8 allot
> flags_chosen_sendmory 8 erase
>
> : choose 10 random ;
> : chosen flags_chosen_vals + 1 swap c! ;
> : chosen_? flags_chosen_vals + c@ ;
>
> : chosen_var_set flags_chosen_sendmory + 1 swap c! ;
> : chosen_var_get flags_chosen_sendmory + c@ ;
>
> : chosen--> dup chosen ;
>
> : chosen_vars_init flags_chosen_sendmory 8 erase ;
> : chosen_vals_init flags_chosen_vals 10 erase ;
>
> : to_s choose chosen--> to s 0 chosen_var_set ;
> : to_e choose dup chosen_? if drop else chosen--> to e 1 chosen_var_set then ;
> : to_n choose dup chosen_? if drop else chosen--> to n 2 chosen_var_set then ;
> : to_d choose dup chosen_? if drop else chosen--> to d 3 chosen_var_set then ;
> : to_m choose dup chosen_? if drop else chosen--> to m 4 chosen_var_set then ;
> : to_o choose dup chosen_? if drop else chosen--> to o 5 chosen_var_set then ;
> : to_r choose dup chosen_? if drop else chosen--> to r 6 chosen_var_set then ;
> : to_y choose dup chosen_? if drop else chosen--> to y 7 chosen_var_set then ;
>
> : gen_sendmory
> chosen_vals_init
> 1 chosen \ mark digit 1 as already chosen
> chosen_vars_init
> 4 chosen_var_set \ mark m as already chosen
> 1 to m \ and set to 1
> to_s
> begin 1 chosen_var_get not while to_e repeat
> begin 2 chosen_var_get not while to_n repeat
> begin 3 chosen_var_get not while to_d repeat
> \ begin 4 chosen_var_get not while to_m repeat
> begin 5 chosen_var_get not while to_o repeat
> begin 6 chosen_var_get not while to_r repeat
> begin 7 chosen_var_get not while to_y repeat
> ;
>
> : .sendmory s . e . n . d . m . o . r . y . ;
>
> : sendmory_as_number s 10 * e + 10 * n + 10 * d + 10 * m + 10 * o + 10 * r + 10 * y + ;
>
> 1000 value max_results_size
> create results max_results_size cells allot
> 0 value result_counter
>
> : to_results
> sendmory_as_number
> result_counter 0 ?do
> dup i cells results + @ = if
> drop unloop exit
> then
> loop
> result_counter cells results + !
> result_counter 1+ to result_counter
> result_counter cr . ." solutions found"
> ;
>
>
> : go_sendmoremoney
> cr
> ." solving ..."
> 0 to result_counter
> 0 do
> gen_sendmory
> is_send+more=money_? if
> ( cr .sendmory)
> to_results
> unloop exit
> then
> loop
> cr cr result_counter . ." solutions found"
> ;
>
> : .send send 4 .r ;
> : .more more 4 .r ;
> : .money money 5 .r ;
>
> : to_sendmory
> 10000000 /mod to s
> 1000000 /mod to e
> 100000 /mod to n
> 10000 /mod to d
> 1000 /mod to m
> 100 /mod to o
> 10 /mod to r
> to y
> ;
>
>
> : .send+more=money .send ." + " .more ." = " .money ;
>
> : .results
> ." sol_num sendmory send + more = money"
> result_counter 0 ?do
> cr i 7 .r 3 spaces
> i cells results + @ dup
> . 3 spaces
> to_sendmory .send+more=money
> loop
> ;
> : .unique_result
> cr ." The unique solution is:" cr
> cr
> ." send + more = money"
> cr
> result_counter 0 ?do
> i cells results + @ dup
> to_sendmory
> m 1 = if
> .send+more=money
> unloop
> exit
> then
> loop
> ;
>
> : go go_sendmoremoney cr .unique_result ;
>
> 10000000 go
>
> bye
Hi, again,
In the previous program, there is a result left on the data stack. it must be dropped.
The new version is here

s" random.fs" included

: not 0= ;

0 value s
0 value e
0 value n
0 value d
0 value m
0 value o
0 value r
0 value y

: send s 10 * e + 10 * n + 10 * d + ;
: more m 10 * o + 10 * r + 10 * e + ;
: money m 10 * o + 10 * n + 10 * e + 10 * y + ;

: is_send+more=money_? send more + money - 0= ;

create flags_chosen_vals 10 allot
flags_chosen_vals 10 erase
create flags_chosen_sendmory 8 allot
flags_chosen_sendmory 8 erase

: choose 10 random ;
: chosen flags_chosen_vals + 1 swap c! ;
: chosen_? flags_chosen_vals + c@ ;

: chosen_var_set flags_chosen_sendmory + 1 swap c! ;
: chosen_var_get flags_chosen_sendmory + c@ ;

: chosen--> dup chosen ;

: chosen_vars_init flags_chosen_sendmory 8 erase ;
: chosen_vals_init flags_chosen_vals 10 erase ;

: to_s choose chosen--> to s 0 chosen_var_set ;
: to_e choose dup chosen_? if drop else chosen--> to e 1 chosen_var_set then ;
: to_n choose dup chosen_? if drop else chosen--> to n 2 chosen_var_set then ;
: to_d choose dup chosen_? if drop else chosen--> to d 3 chosen_var_set then ;
: to_m choose dup chosen_? if drop else chosen--> to m 4 chosen_var_set then ;
: to_o choose dup chosen_? if drop else chosen--> to o 5 chosen_var_set then ;
: to_r choose dup chosen_? if drop else chosen--> to r 6 chosen_var_set then ;
: to_y choose dup chosen_? if drop else chosen--> to y 7 chosen_var_set then ;
: gen_sendmory
chosen_vals_init
1 chosen \ mark digit 1 as already chosen
chosen_vars_init
4 chosen_var_set \ mark m as already chosen
1 to m \ and set to 1

to_s
begin 1 chosen_var_get not while to_e repeat
begin 2 chosen_var_get not while to_n repeat
begin 3 chosen_var_get not while to_d repeat
\ begin 4 chosen_var_get not while to_m repeat
begin 5 chosen_var_get not while to_o repeat
begin 6 chosen_var_get not while to_r repeat
begin 7 chosen_var_get not while to_y repeat
;

: .sendmory s . e . n . d . m . o . r . y . ;

: sendmory_as_number s 10 * e + 10 * n + 10 * d + 10 * m + 10 * o + 10 * r + 10 * y + ;

1000 value max_results_size
create results max_results_size cells allot
0 value result_counter

: to_results
sendmory_as_number
result_counter 0 ?do
dup i cells results + @ = if
drop unloop exit
then
loop
result_counter cells results + !
result_counter 1+ to result_counter
result_counter cr . ." solutions found"
;

: go_sendmoremoney
cr
." solving ..."
0 to result_counter
0 do
gen_sendmory
is_send+more=money_? if
( cr .sendmory)
to_results
unloop exit
then
loop
cr cr result_counter . ." solutions found"
;

: .send send 4 .r ;
: .more more 4 .r ;
: .money money 5 .r ;

: to_sendmory
10000000 /mod to s
1000000 /mod to e
100000 /mod to n
10000 /mod to d
1000 /mod to m
100 /mod to o
10 /mod to r
to y
;


: .send+more=money .send ." + " .more ." = " .money ;

: .results
." sol_num sendmory send + more = money"
result_counter 0 ?do
cr i 7 .r 3 spaces
i cells results + @ dup
. 3 spaces
to_sendmory .send+more=money
loop
;
Click here to read the complete article

Re: SEND+MORE=MONEY

<db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:57c5:0:b0:3a8:2e9f:6ae9 with SMTP id w5-20020ac857c5000000b003a82e9f6ae9mr1518859qta.293.1675952678615;
Thu, 09 Feb 2023 06:24:38 -0800 (PST)
X-Received: by 2002:a05:6902:386:b0:8cc:fd68:808b with SMTP id
f6-20020a056902038600b008ccfd68808bmr409052ybs.245.1675952678314; Thu, 09 Feb
2023 06:24:38 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 9 Feb 2023 06:24:38 -0800 (PST)
In-Reply-To: <7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f2e:e909:98a:9b52:9ace:a35c;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f2e:e909:98a:9b52:9ace:a35c
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<787c9189-9528-4a55-8462-8e924c68ff7cn@googlegroups.com> <7f3b51ea-1680-4d80-890b-28ac718d288fn@googlegroups.com>
<7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Thu, 09 Feb 2023 14:24:38 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2899
 by: minf...@arcor.de - Thu, 9 Feb 2023 14:24 UTC

Ahmed MELAHI schrieb am Donnerstag, 9. Februar 2023 um 13:47:02 UTC+1:
> For the case of m<>0 (so m must be 1), the same program gives the also the unique result, by selecting the solution with m=1.

Merci de tes contributions! Of course M has to be 1 because it has to be a carry bit.
So you used a mathematical property of one of the constraints to manually reduce your search space.

BTW this shows an interesting common aspect between all the various Forth proposals:
In their manually coded program formulation they freely join/mix/meddle walking the search space with constraint properties.
Therefore many different solutions appear on the table depending on programmer's expertise or preference.

Declarative constraint programming languages don't have to do this (ideally). They go in distinctive not related steps:
1) declare the variable domains ( here: integers ranging from 0 to 9 )
2) span the search space in toto ( here: 8 variables SENDMORY )
3) declare the constraints ( here: M<>0 and SEND+MORE=MONEY and all variables unique)
\ BTW: M<>0 not because of the other constraint but because otherwise MONEY would be written as ONEY ! )
4) solve it.
( of course real CLP programmers also use their optimization toolbelts ... but that's a different story )

So this is a very generic and very versatile approach! One can add/delete/change constraints in one place without
having to rewrite the program. And the best: bug-free from start.

How would a Forth programmer come close to this?

( for fun: try to solve TO+GO=OUT )

Re: SEND+MORE=MONEY

<37af413b-e1df-4c4d-b1d3-154b318232dcn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:8bda:0:b0:56c:2072:a528 with SMTP id a26-20020a0c8bda000000b0056c2072a528mr556269qvc.62.1675954289793;
Thu, 09 Feb 2023 06:51:29 -0800 (PST)
X-Received: by 2002:a81:5a54:0:b0:52b:dee3:ae3a with SMTP id
o81-20020a815a54000000b0052bdee3ae3amr845384ywb.457.1675954289312; Thu, 09
Feb 2023 06:51:29 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 9 Feb 2023 06:51:29 -0800 (PST)
In-Reply-To: <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=87.95.64.138; posting-account=kiOBZQoAAADFsAs31ZHaefxTuQxv84Wm
NNTP-Posting-Host: 87.95.64.138
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<787c9189-9528-4a55-8462-8e924c68ff7cn@googlegroups.com> <7f3b51ea-1680-4d80-890b-28ac718d288fn@googlegroups.com>
<7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com> <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <37af413b-e1df-4c4d-b1d3-154b318232dcn@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: jali.hei...@gmail.com (Jali Heinonen)
Injection-Date: Thu, 09 Feb 2023 14:51:29 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3187
 by: Jali Heinonen - Thu, 9 Feb 2023 14:51 UTC

torstai 9. helmikuuta 2023 klo 16.24.39 UTC+2 minf...@arcor.de kirjoitti:
> Ahmed MELAHI schrieb am Donnerstag, 9. Februar 2023 um 13:47:02 UTC+1:
> > For the case of m<>0 (so m must be 1), the same program gives the also the unique result, by selecting the solution with m=1.
> Merci de tes contributions! Of course M has to be 1 because it has to be a carry bit.
> So you used a mathematical property of one of the constraints to manually reduce your search space.
>
> BTW this shows an interesting common aspect between all the various Forth proposals:
> In their manually coded program formulation they freely join/mix/meddle walking the search space with constraint properties.
> Therefore many different solutions appear on the table depending on programmer's expertise or preference.
>
> Declarative constraint programming languages don't have to do this (ideally). They go in distinctive not related steps:
> 1) declare the variable domains ( here: integers ranging from 0 to 9 )
> 2) span the search space in toto ( here: 8 variables SENDMORY )
> 3) declare the constraints ( here: M<>0 and SEND+MORE=MONEY and all variables unique)
> \ BTW: M<>0 not because of the other constraint but because otherwise MONEY would be written as ONEY ! )
> 4) solve it.
> ( of course real CLP programmers also use their optimization toolbelts ... but that's a different story )
>
> So this is a very generic and very versatile approach! One can add/delete/change constraints in one place without
> having to rewrite the program. And the best: bug-free from start.
>
> How would a Forth programmer come close to this?
>
> ( for fun: try to solve TO+GO=OUT )

I think, I have to try my bit based idea. I have used it succesfully for a Sudoku solver before and it worked nicely: https://pastebin.com/v5P0hCYA

Re: SEND+MORE=MONEY

<8dbc4417-ee44-4d42-bd62-f4ab99bda32bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:8e03:0:b0:72f:7b06:601b with SMTP id q3-20020a378e03000000b0072f7b06601bmr1230964qkd.96.1675958405664;
Thu, 09 Feb 2023 08:00:05 -0800 (PST)
X-Received: by 2002:a0d:c546:0:b0:506:6dab:e1b3 with SMTP id
h67-20020a0dc546000000b005066dabe1b3mr1149965ywd.467.1675958405340; Thu, 09
Feb 2023 08:00:05 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 9 Feb 2023 08:00:05 -0800 (PST)
In-Reply-To: <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=154.121.51.36; posting-account=KJSw4AoAAACRkUCek5r_78mFj6sHzH4C
NNTP-Posting-Host: 154.121.51.36
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<787c9189-9528-4a55-8462-8e924c68ff7cn@googlegroups.com> <7f3b51ea-1680-4d80-890b-28ac718d288fn@googlegroups.com>
<7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com> <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8dbc4417-ee44-4d42-bd62-f4ab99bda32bn@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: ahmed.me...@univ-bejaia.dz (Ahmed MELAHI)
Injection-Date: Thu, 09 Feb 2023 16:00:05 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Ahmed MELAHI - Thu, 9 Feb 2023 16:00 UTC

Le jeudi 9 février 2023 à 14:24:39 UTC, minf...@arcor.de a écrit :
> Ahmed MELAHI schrieb am Donnerstag, 9. Februar 2023 um 13:47:02 UTC+1:
> > For the case of m<>0 (so m must be 1), the same program gives the also the unique result, by selecting the solution with m=1.
> Merci de tes contributions! Of course M has to be 1 because it has to be a carry bit.
> So you used a mathematical property of one of the constraints to manually reduce your search space.
>
> BTW this shows an interesting common aspect between all the various Forth proposals:
> In their manually coded program formulation they freely join/mix/meddle walking the search space with constraint properties.
> Therefore many different solutions appear on the table depending on programmer's expertise or preference.
>
> Declarative constraint programming languages don't have to do this (ideally). They go in distinctive not related steps:
> 1) declare the variable domains ( here: integers ranging from 0 to 9 )
> 2) span the search space in toto ( here: 8 variables SENDMORY )
> 3) declare the constraints ( here: M<>0 and SEND+MORE=MONEY and all variables unique)
> \ BTW: M<>0 not because of the other constraint but because otherwise MONEY would be written as ONEY ! )
> 4) solve it.
> ( of course real CLP programmers also use their optimization toolbelts .... but that's a different story )
>
> So this is a very generic and very versatile approach! One can add/delete/change constraints in one place without
> having to rewrite the program. And the best: bug-free from start.
>
> How would a Forth programmer come close to this?
>
> ( for fun: try to solve TO+GO=OUT )
Hi again,
Prolog implemets CLP (Constrained Logic Programming), so one can solve this type of problems.
There is a prolog compiler written in forth, (see forth dimension magazine)..
One can create a DSL in forth to solve this type of problems.
Yes the solution given previously is specific to this case.
But the approach can be generalized.
Here is the adaptation of the previous program to the case to+go=out. Perhaps, this gives an idea to generalize this approach to solve this type of problems.

s" random.fs" included

: not 0= ;

0 value t
0 value o
0 value g
0 value u

: to_ t 10 * o + ;
: go_ g 10 * o + ;
: out_ o 10 * u + 10 * t + ;

: is_to+go=out_? to_ go_ + out_ - 0= ;

create flags_chosen_vals 10 allot
flags_chosen_vals 10 erase
create flags_chosen_togu 4 allot
flags_chosen_togu 4 erase

: choose 10 random ;
: chosen flags_chosen_vals + 1 swap c! ;
: chosen_? flags_chosen_vals + c@ ;

: chosen_var_set flags_chosen_togu + 1 swap c! ;
: chosen_var_get flags_chosen_togu + c@ ;

: chosen--> dup chosen ;

: chosen_vars_init flags_chosen_togu 4 erase ;
: chosen_vals_init flags_chosen_vals 10 erase ;

: to_t choose chosen--> to t 0 chosen_var_set ;
: to_o choose dup chosen_? if drop else chosen--> to o 1 chosen_var_set then ;
: to_g choose dup chosen_? if drop else chosen--> to g 2 chosen_var_set then ;
: to_u choose dup chosen_? if drop else chosen--> to u 3 chosen_var_set then ;
: gen_togu
chosen_vals_init
1 chosen \ mark digit 1 as already chosen
chosen_vars_init
1 chosen_var_set \ mark o as already chosen
1 to o \ and set to 1

begin 0 chosen_var_get not while to_t repeat
begin 2 chosen_var_get not while to_g repeat
begin 3 chosen_var_get not while to_u repeat
;

: .togu t . o . g . u . ;

: togu_as_number t 10 * o + 10 * g + 10 * u + ;

1000 value max_results_size
create results max_results_size cells allot
0 value result_counter

: to_results
togu_as_number
result_counter 0 ?do
dup i cells results + @ = if
drop
unloop exit
then
loop
result_counter cells results + !
result_counter 1+ to result_counter
result_counter cr . ." solutions found"
;

: go_togoout
cr
." solving ..."
0 to result_counter
0 do
gen_togu
is_to+go=out_? if
( cr .togu)
to_results
\ unloop exit
then
loop
cr cr result_counter . ." solutions found"
;

: .to to_ 2 .r ;
: .go go_ 2 .r ;
: .out out_ 3 .r ;

: to_togu
1000 /mod to t
100 /mod to o
10 /mod to g
to u
;


: .to+go=out .to ." + " .go ." = " .out ;

: .results
." sol_num togu to + go = out"
result_counter 0 ?do
cr i 7 .r 3 spaces
i cells results + @ dup
. 3 spaces
to_togu .to+go=out
loop
;

: .unique_result
cr ." The unique solution is:" cr
cr
." to + go = out"
cr
result_counter 0 ?do
i cells results + @
to_togu
o 1 = if
.to+go=out
\ unloop exit
then
loop
;

: go go_togoout cr ( .results) ;

10000000 go

Re: SEND+MORE=MONEY

<87pmaiztp1.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: SEND+MORE=MONEY
Date: Thu, 09 Feb 2023 08:31:38 -0800
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <87pmaiztp1.fsf@nightsong.com>
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<87ttzvzmmb.fsf@nightsong.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="e5409055a028117a873680ba62c07629";
logging-data="771540"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+61ps91I81uFBJfktJAAWY"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:SYf8VauoCsWeAmbFozwkuRgx2Mg=
sha1:HzOldRufCSyO2gpMgisjP9HesTU=
 by: Paul Rubin - Thu, 9 Feb 2023 16:31 UTC

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> You only generate 10!=3_628_800 permutations, while minforth generates
> 100_000_000 variants that he checks for the alldifferent property only
> afterwards, but apparently the constant factor of Python3 is so much
> worse than that of gforth-fast that minforth's version prevails.

I think it's not just the Python interpreter, but the code itself is
doing a lot of tuple packing and packing, recursively generating the
permutations, passing them to the search routine through a coroutine
mechanism, etc. So there was a lot of memory allocation and freeing,
etc. I will try the same thing in Haskell when I get a chance, and also
try to figure out what is going wrong in my Forth version.

Re: SEND+MORE=MONEY

<87lel6ztnr.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: SEND+MORE=MONEY
Date: Thu, 09 Feb 2023 08:32:24 -0800
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <87lel6ztnr.fsf@nightsong.com>
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<87ttzvzmmb.fsf@nightsong.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at>
<a61c497f-56a2-42e8-97fa-c87d7a82115bn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="e5409055a028117a873680ba62c07629";
logging-data="771540"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bOM9qoOm9eJvUHx0uS0d7"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:rOiE54vF944ccUzULZ0OOGRysoU=
sha1:B9pEYke4vC/zXdZdE2OMmuqSMgM=
 by: Paul Rubin - Thu, 9 Feb 2023 16:32 UTC

Jali Heinonen <jali.heinonen@gmail.com> writes:
> Can ALLDIFFERENT be eliminated by using bit presentation for numbers,

I did something like that in a permutation generator in Forth, but
something else is going wrong that I haven't yet debugged.

Re: SEND+MORE=MONEY

<4226ca19-ff19-4462-9ea5-253672de2b9fn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:b315:0:b0:537:6bb8:63d3 with SMTP id s21-20020a0cb315000000b005376bb863d3mr1106468qve.54.1675960740265;
Thu, 09 Feb 2023 08:39:00 -0800 (PST)
X-Received: by 2002:a25:8602:0:b0:80b:7021:b88d with SMTP id
y2-20020a258602000000b0080b7021b88dmr1569418ybk.93.1675960740039; Thu, 09 Feb
2023 08:39:00 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 9 Feb 2023 08:38:59 -0800 (PST)
In-Reply-To: <8dbc4417-ee44-4d42-bd62-f4ab99bda32bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=154.121.51.36; posting-account=KJSw4AoAAACRkUCek5r_78mFj6sHzH4C
NNTP-Posting-Host: 154.121.51.36
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<787c9189-9528-4a55-8462-8e924c68ff7cn@googlegroups.com> <7f3b51ea-1680-4d80-890b-28ac718d288fn@googlegroups.com>
<7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com> <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>
<8dbc4417-ee44-4d42-bd62-f4ab99bda32bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4226ca19-ff19-4462-9ea5-253672de2b9fn@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: ahmed.me...@univ-bejaia.dz (Ahmed MELAHI)
Injection-Date: Thu, 09 Feb 2023 16:39:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 10444
 by: Ahmed MELAHI - Thu, 9 Feb 2023 16:38 UTC

Le jeudi 9 février 2023 à 16:00:10 UTC, Ahmed MELAHI a écrit :
> Le jeudi 9 février 2023 à 14:24:39 UTC, minf...@arcor.de a écrit :
> > Ahmed MELAHI schrieb am Donnerstag, 9. Februar 2023 um 13:47:02 UTC+1:
> > > For the case of m<>0 (so m must be 1), the same program gives the also the unique result, by selecting the solution with m=1.
> > Merci de tes contributions! Of course M has to be 1 because it has to be a carry bit.
> > So you used a mathematical property of one of the constraints to manually reduce your search space.
> >
> > BTW this shows an interesting common aspect between all the various Forth proposals:
> > In their manually coded program formulation they freely join/mix/meddle walking the search space with constraint properties.
> > Therefore many different solutions appear on the table depending on programmer's expertise or preference.
> >
> > Declarative constraint programming languages don't have to do this (ideally). They go in distinctive not related steps:
> > 1) declare the variable domains ( here: integers ranging from 0 to 9 )
> > 2) span the search space in toto ( here: 8 variables SENDMORY )
> > 3) declare the constraints ( here: M<>0 and SEND+MORE=MONEY and all variables unique)
> > \ BTW: M<>0 not because of the other constraint but because otherwise MONEY would be written as ONEY ! )
> > 4) solve it.
> > ( of course real CLP programmers also use their optimization toolbelts .... but that's a different story )
> >
> > So this is a very generic and very versatile approach! One can add/delete/change constraints in one place without
> > having to rewrite the program. And the best: bug-free from start.
> >
> > How would a Forth programmer come close to this?
> >
> > ( for fun: try to solve TO+GO=OUT )
> Hi again,
> Prolog implemets CLP (Constrained Logic Programming), so one can solve this type of problems.
> There is a prolog compiler written in forth, (see forth dimension magazine).
> One can create a DSL in forth to solve this type of problems.
> Yes the solution given previously is specific to this case.
> But the approach can be generalized.
> Here is the adaptation of the previous program to the case to+go=out. Perhaps, this gives an idea to generalize this approach to solve this type of problems.
> s" random.fs" included
>
> : not 0= ;
> 0 value t
> 0 value o
> 0 value g
> 0 value u
>
> : to_ t 10 * o + ;
> : go_ g 10 * o + ;
> : out_ o 10 * u + 10 * t + ;
>
> : is_to+go=out_? to_ go_ + out_ - 0= ;
> create flags_chosen_vals 10 allot
> flags_chosen_vals 10 erase
> create flags_chosen_togu 4 allot
> flags_chosen_togu 4 erase
> : choose 10 random ;
> : chosen flags_chosen_vals + 1 swap c! ;
> : chosen_? flags_chosen_vals + c@ ;
> : chosen_var_set flags_chosen_togu + 1 swap c! ;
> : chosen_var_get flags_chosen_togu + c@ ;
>
> : chosen--> dup chosen ;
>
> : chosen_vars_init flags_chosen_togu 4 erase ;
> : chosen_vals_init flags_chosen_vals 10 erase ;
>
> : to_t choose chosen--> to t 0 chosen_var_set ;
> : to_o choose dup chosen_? if drop else chosen--> to o 1 chosen_var_set then ;
> : to_g choose dup chosen_? if drop else chosen--> to g 2 chosen_var_set then ;
> : to_u choose dup chosen_? if drop else chosen--> to u 3 chosen_var_set then ;
>
> : gen_togu
> chosen_vals_init
> 1 chosen \ mark digit 1 as already chosen
> chosen_vars_init
> 1 chosen_var_set \ mark o as already chosen
> 1 to o \ and set to 1
>
> begin 0 chosen_var_get not while to_t repeat
> begin 2 chosen_var_get not while to_g repeat
> begin 3 chosen_var_get not while to_u repeat
> ;
>
> : .togu t . o . g . u . ;
>
> : togu_as_number t 10 * o + 10 * g + 10 * u + ;
> 1000 value max_results_size
> create results max_results_size cells allot
> 0 value result_counter
>
> : to_results
> togu_as_number
> result_counter 0 ?do
> dup i cells results + @ = if
> drop
> unloop exit
> then
> loop
> result_counter cells results + !
> result_counter 1+ to result_counter
> result_counter cr . ." solutions found"
> ;
> : go_togoout
> cr
> ." solving ..."
> 0 to result_counter
> 0 do
> gen_togu
> is_to+go=out_? if
> ( cr .togu)
> to_results
> \ unloop exit
> then
> loop
> cr cr result_counter . ." solutions found"
> ;
> : .to to_ 2 .r ;
> : .go go_ 2 .r ;
> : .out out_ 3 .r ;
>
> : to_togu
> 1000 /mod to t
> 100 /mod to o
> 10 /mod to g
> to u
> ;
>
>
> : .to+go=out .to ." + " .go ." = " .out ;
>
> : .results
> ." sol_num togu to + go = out"
> result_counter 0 ?do
> cr i 7 .r 3 spaces
> i cells results + @ dup
> . 3 spaces
> to_togu .to+go=out
> loop
> ;
>
>
> : .unique_result
> cr ." The unique solution is:" cr
> cr
> ." to + go = out"
> cr
> result_counter 0 ?do
> i cells results + @
> to_togu
> o 1 = if
> .to+go=out
> \ unloop exit
> then
> loop
> ;
>
> : go go_togoout cr ( .results) ;
>
> 10000000 go
Hi,
This program takes about 2 ms to give the unique result.
s" random.fs" included

: not 0= ;

0 value t
0 value o
0 value g
0 value u

: to_ t 10 * o + ;
: go_ g 10 * o + ;
: out_ o 10 * u + 10 * t + ;

: is_to+go=out_? to_ go_ + out_ - 0= ;

create flags_chosen_vals 10 allot
flags_chosen_vals 10 erase
create flags_chosen_togu 4 allot
flags_chosen_togu 4 erase

: choose 10 random ;
: chosen flags_chosen_vals + 1 swap c! ;
: chosen_? flags_chosen_vals + c@ ;

: chosen_var_set flags_chosen_togu + 1 swap c! ;
: chosen_var_get flags_chosen_togu + c@ ;

: chosen--> dup chosen ;

: chosen_vars_init flags_chosen_togu 4 erase ;
: chosen_vals_init flags_chosen_vals 10 erase ;

: to_t choose chosen--> to t 0 chosen_var_set ;
: to_o choose dup chosen_? if drop else chosen--> to o 1 chosen_var_set then ;
: to_g choose dup chosen_? if drop else chosen--> to g 2 chosen_var_set then ;
: to_u choose dup chosen_? if drop else chosen--> to u 3 chosen_var_set then ;
: gen_togu
chosen_vals_init
1 chosen \ mark digit 1 as already chosen
chosen_vars_init
1 chosen_var_set \ mark o as already chosen
1 to o \ and set to 1

begin 0 chosen_var_get not while to_t repeat
begin 2 chosen_var_get not while to_g repeat
begin 3 chosen_var_get not while to_u repeat
;

: .togu t . o . g . u . ;

: togu_as_number t 10 * o + 10 * g + 10 * u + ;

1000 value max_results_size
create results max_results_size cells allot
0 value result_counter

: to_results
togu_as_number
result_counter 0 ?do
dup i cells results + @ = if
drop
unloop exit
then
loop
result_counter cells results + !
result_counter 1+ to result_counter
result_counter cr . ." solutions found"
;

: go_togoout
cr
." solving ..."
0 to result_counter
0 do
gen_togu
is_to+go=out_? if
( cr .togu)
to_results
unloop exit
then
loop
cr cr result_counter . ." solutions found"
;

: .to to_ 2 .r ;
: .go go_ 2 .r ;
: .out out_ 3 .r ;

: to_togu
1000 /mod to t
100 /mod to o
10 /mod to g
to u
;


: .to+go=out .to ." + " .go ." = " .out ;

: .results
." sol_num togu to + go = out"
result_counter 0 ?do
cr i 7 .r 3 spaces
i cells results + @ dup
. 3 spaces
to_togu .to+go=out
loop
;

: .unique_result
cr ." The unique solution is:" cr
cr
." to + go = out"
cr
result_counter 0 ?do
i cells results + @
to_togu
o 1 = if
.to+go=out
unloop exit
then
loop
;


Click here to read the complete article
Re: SEND+MORE=MONEY

<2023Feb9.174406@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: SEND+MORE=MONEY
Date: Thu, 09 Feb 2023 16:44:06 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 45
Message-ID: <2023Feb9.174406@mips.complang.tuwien.ac.at>
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com> <787c9189-9528-4a55-8462-8e924c68ff7cn@googlegroups.com> <7f3b51ea-1680-4d80-890b-28ac718d288fn@googlegroups.com> <7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com> <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>
Injection-Info: reader01.eternal-september.org; posting-host="4a23064dba6cc3b448d0d7b13f318f12";
logging-data="782389"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sUKJbocqmgLRZXxwZv5kp"
Cancel-Lock: sha1:McCrdQ7/R66TuX8Wm2XXzJYQH2Y=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 9 Feb 2023 16:44 UTC

"minf...@arcor.de" <minforth@arcor.de> writes:
>Declarative constraint programming languages don't have to do this (ideally). They go in distinctive not related steps:
>1) declare the variable domains ( here: integers ranging from 0 to 9 )
>2) span the search space in toto ( here: 8 variables SENDMORY )
>3) declare the constraints ( here: M<>0 and SEND+MORE=MONEY and all variables unique)
>\ BTW: M<>0 not because of the other constraint but because otherwise MONEY would be written as ONEY ! )
>4) solve it.
>( of course real CLP programmers also use their optimization toolbelts ... but that's a different story )

Not sure what step 2 and step 4 means.

Classical generate-and-test (as in your program and in plain Prolog) does:

1) Generate all assignments to all variables
2) test if the assignment is a solution to the problem

With constraint logic programming (CLP) these two steps are reversed:

2a) specify the domains of the variables
2b) specify the other constraints
1) Generate all assignments to all variables (labeling)

As soon as a variable is assigned, constraints on that variable
propagate to the other variables in the constraint. E.g., with the
alldifferent/1 constraint, if one variable receives a value, that
value is removed from all the other variables.

>So this is a very generic and very versatile approach! One can add/delete/change constraints in one place without
>having to rewrite the program. And the best: bug-free from start.

I wish.

>How would a Forth programmer come close to this?

Have a high level that works pretty much the same way, and implement
these high-level features in Forth. I heard that some group coming
from CLP then went on to provide this approach as a C++ library or
somesuch.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2022: https://euro.theforth.net

locals slowness in sf and vfx (was: SEND+MORE=MONEY)

<2023Feb9.181354@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: locals slowness in sf and vfx (was: SEND+MORE=MONEY)
Date: Thu, 09 Feb 2023 17:13:54 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 30
Message-ID: <2023Feb9.181354@mips.complang.tuwien.ac.at>
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com> <87ttzvzmmb.fsf@nightsong.com> <2023Feb9.084758@mips.complang.tuwien.ac.at> <138b28de-6f2a-449b-9279-629f3c17a03bn@googlegroups.com> <2023Feb9.115420@mips.complang.tuwien.ac.at>
Injection-Info: reader01.eternal-september.org; posting-host="4a23064dba6cc3b448d0d7b13f318f12";
logging-data="790587"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZWsfxH1vfQXUR3xommyNa"
Cancel-Lock: sha1:LcXNgSskggvHCsYhY6TXgCioi6Y=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 9 Feb 2023 17:13 UTC

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>The lxf result demonstrates that locals can be implemented much more
>efficiently than in VFX or in SwiftForth.

One reason for the slowness of VFX and SwiftForth is that they produce
many more branch mispredictions (on Zen3):

lxf sf 4.0.0 RC52 vfx64 5.11 RC2
1_661_643_918 5_213_828_602 6_905_863_327 cycles:u
5_033_144_481 11_408_344_624 9_084_604_276 instructions:u
4_371_603 70_048_027 72_169_382 branch-misses

http://www.complang.tuwien.ac.at/forth/programs/sendmore.fth

A misprediction typically costs 20 cycles, so the 66M-68M additional
mispredictions cost 1.3G-1.4G cycles which does not explain all of the
slowdown, but a good part of it.

These mispredictions are caused by the technique of pushing an
additional return address that returns to other code than that where
the last call came from. The hardware return stack for branch
prediction was introduced at least 25 years ago, it's time that Forth
systems accept that reality and let go of this technique.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2022: https://euro.theforth.net

Re: SEND+MORE=MONEY

<9ef3d369-4608-4e7e-9375-a3cce2bd245cn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5c01:0:b0:3ba:308a:1e71 with SMTP id i1-20020ac85c01000000b003ba308a1e71mr1847349qti.327.1675967300422;
Thu, 09 Feb 2023 10:28:20 -0800 (PST)
X-Received: by 2002:ac8:59d2:0:b0:3b8:2edf:bac1 with SMTP id
f18-20020ac859d2000000b003b82edfbac1mr1690629qtf.328.1675967300126; Thu, 09
Feb 2023 10:28:20 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 9 Feb 2023 10:28:19 -0800 (PST)
In-Reply-To: <2023Feb9.174406@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f2e:e909:98a:9b52:9ace:a35c;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f2e:e909:98a:9b52:9ace:a35c
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<787c9189-9528-4a55-8462-8e924c68ff7cn@googlegroups.com> <7f3b51ea-1680-4d80-890b-28ac718d288fn@googlegroups.com>
<7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com> <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>
<2023Feb9.174406@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9ef3d369-4608-4e7e-9375-a3cce2bd245cn@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Thu, 09 Feb 2023 18:28:20 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3050
 by: minf...@arcor.de - Thu, 9 Feb 2023 18:28 UTC

Anton Ertl schrieb am Donnerstag, 9. Februar 2023 um 18:06:38 UTC+1:
> "minf...@arcor.de" <minf...@arcor.de> writes:
> >Declarative constraint programming languages don't have to do this (ideally). They go in distinctive not related steps:
> >1) declare the variable domains ( here: integers ranging from 0 to 9 )
> >2) span the search space in toto ( here: 8 variables SENDMORY )
> >3) declare the constraints ( here: M<>0 and SEND+MORE=MONEY and all variables unique)
> >\ BTW: M<>0 not because of the other constraint but because otherwise MONEY would be written as ONEY ! )
> >4) solve it.
> >( of course real CLP programmers also use their optimization toolbelts ... but that's a different story )
> Not sure what step 2 and step 4 means.
>
> Classical generate-and-test (as in your program and in plain Prolog) does:
>
> 1) Generate all assignments to all variables
> 2) test if the assignment is a solution to the problem
>
> With constraint logic programming (CLP) these two steps are reversed:
>
> 2a) specify the domains of the variables
> 2b) specify the other constraints
> 1) Generate all assignments to all variables (labeling)
>
> As soon as a variable is assigned, constraints on that variable
> propagate to the other variables in the constraint. E.g., with the
> alldifferent/1 constraint, if one variable receives a value, that
> value is removed from all the other variables.

We are trying to do things the Forth way and can't use labeling.
Still it can be done without labeling, look here
https://www.swi-prolog.org/pldoc/man?section=clpfd-search

Re: SEND+MORE=MONEY

<87h6vuzl8v.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: SEND+MORE=MONEY
Date: Thu, 09 Feb 2023 11:34:08 -0800
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <87h6vuzl8v.fsf@nightsong.com>
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<87ttzvzmmb.fsf@nightsong.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at>
<87pmaiztp1.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="e5409055a028117a873680ba62c07629";
logging-data="815729"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wbIA9sPTx41o3yRPGsLlW"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:AF1Y+prWeXtKHz2PJGheFVkZDBY=
sha1:kojPYcCXO3k6aPLiBD6CGzTKQ1Y=
 by: Paul Rubin - Thu, 9 Feb 2023 19:34 UTC

Paul Rubin <no.email@nospam.invalid> writes:
> I will try the same thing in Haskell when I get a chance, and also
> try to figure out what is going wrong in my Forth version.

Here is the Haskell version. CPU time with ghc 8.8.4 -O3 is 0.472s sec
so about 6x the speed of Python3 3.9 on my laptop. In both cases there
are obvious optimizations possible at the expense of complicating the
code slightly, such as generating only half the permutations instead
of throwing away the ones with x0>=x1. GHC 8.8.4 is now somewhat
outdated and newer versions might generate the better code.

Note the type annotation (Int,Int,Int) which tells the compiler that
the values are (64 bit) machine integers. Without the annotation it
would use Integer which is bignums. In that case, cpu time is 1.085s,
so still 3x the speed of Python.

================================================================

import Data.List (permutations)

main = print $ [(send,more,money) :: (Int,Int,Int)
| [x0,x1,s,e,n,d,m,o,r,y] <- permutations [0..9]
, x0 < x1 && m > 0
, let { send=1000*s+100*e+10*n+d;
more=1000*m+100*o+10*r+e;
money=10000*m+1000*o+100*n+10*e+y
}
, send+more == money
]

Re: SEND+MORE=MONEY

<41d18706-46a2-4a8f-8c43-d7effa386bc3n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:8bc9:0:b0:56e:909b:f41d with SMTP id a9-20020a0c8bc9000000b0056e909bf41dmr48510qvc.78.1675976596970;
Thu, 09 Feb 2023 13:03:16 -0800 (PST)
X-Received: by 2002:a0c:f5c4:0:b0:56c:2246:e078 with SMTP id
q4-20020a0cf5c4000000b0056c2246e078mr481699qvm.64.1675976596774; Thu, 09 Feb
2023 13:03:16 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 9 Feb 2023 13:03:16 -0800 (PST)
In-Reply-To: <87h6vuzl8v.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=79.224.102.188; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 79.224.102.188
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<87ttzvzmmb.fsf@nightsong.com> <2023Feb9.084758@mips.complang.tuwien.ac.at>
<87pmaiztp1.fsf@nightsong.com> <87h6vuzl8v.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <41d18706-46a2-4a8f-8c43-d7effa386bc3n@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Thu, 09 Feb 2023 21:03:16 +0000
Content-Type: text/plain; charset="UTF-8"
 by: minf...@arcor.de - Thu, 9 Feb 2023 21:03 UTC

Paul Rubin schrieb am Donnerstag, 9. Februar 2023 um 20:34:11 UTC+1:
> Paul Rubin <no.e...@nospam.invalid> writes:
> > I will try the same thing in Haskell when I get a chance, and also
> > try to figure out what is going wrong in my Forth version.
> Here is the Haskell version. CPU time with ghc 8.8.4 -O3 is 0.472s sec
> so about 6x the speed of Python3 3.9 on my laptop. In both cases there
> are obvious optimizations possible at the expense of complicating the
> code slightly, such as generating only half the permutations instead
> of throwing away the ones with x0>=x1. GHC 8.8.4 is now somewhat
> outdated and newer versions might generate the better code.
>
> Note the type annotation (Int,Int,Int) which tells the compiler that
> the values are (64 bit) machine integers. Without the annotation it
> would use Integer which is bignums. In that case, cpu time is 1.085s,
> so still 3x the speed of Python.
>
> ================================================================
>
> import Data.List (permutations)
>
> main = print $ [(send,more,money) :: (Int,Int,Int)
> | [x0,x1,s,e,n,d,m,o,r,y] <- permutations [0..9]
> , x0 < x1 && m > 0
> , let { send=1000*s+100*e+10*n+d;
> more=1000*m+100*o+10*r+e;
> money=10000*m+1000*o+100*n+10*e+y
> }
> , send+more == money
> ]

This over my head. X0 and X1 declared but never used?
Wild guess: these are control variable to create a smaller triangulated
(triangulized?) search space

Re: SEND+MORE=MONEY

<878rh6coyt.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: SEND+MORE=MONEY
Date: Thu, 09 Feb 2023 17:02:18 -0800
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <878rh6coyt.fsf@nightsong.com>
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<87ttzvzmmb.fsf@nightsong.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at>
<87pmaiztp1.fsf@nightsong.com> <87h6vuzl8v.fsf@nightsong.com>
<41d18706-46a2-4a8f-8c43-d7effa386bc3n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="9e8385a1d607cf663d6463ca27b2b288";
logging-data="885415"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX196egwBVWED2Ww2Q1XRe84G"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:B7rxacpQ7+Ww5NcT6WBrtqFFbyI=
sha1:+psAma6iKmQF2XJdx6YfyWlXSqY=
 by: Paul Rubin - Fri, 10 Feb 2023 01:02 UTC

"minf...@arcor.de" <minforth@arcor.de> writes:
> This over my head. X0 and X1 declared but never used?
> Wild guess: these are control variable to create a smaller triangulated
> (triangulized?) search space

There are 10 digits that get permuted, but you only care about 8 of
them. x0 and x1 are the other two. Imagine that they happen to be 3
and 5, and SENDMORY are a permutation of the other 8 digits. Then you
will see another 10-digit permutation where x0,x1 are 5,3 instead of
3,5, i.e. the solution will appear twice. To filter out that duplicate,
you only count the cases where x0<x1. With x0 and x1 switched you will
have x1<x0 and otherwise the same solution.

Re: SEND+MORE=MONEY

<e63b76a2-783f-4663-9c60-96ad2ffc9e47n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ae9:d803:0:b0:71f:af75:9914 with SMTP id u3-20020ae9d803000000b0071faf759914mr1142339qkf.164.1675991536393;
Thu, 09 Feb 2023 17:12:16 -0800 (PST)
X-Received: by 2002:ac8:5946:0:b0:3b9:c212:c48d with SMTP id
6-20020ac85946000000b003b9c212c48dmr2277438qtz.368.1675991536113; Thu, 09 Feb
2023 17:12:16 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 9 Feb 2023 17:12:15 -0800 (PST)
In-Reply-To: <02ddb9a9-880e-4ba7-b884-d0c0d837049fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=154.121.56.200; posting-account=KJSw4AoAAACRkUCek5r_78mFj6sHzH4C
NNTP-Posting-Host: 154.121.56.200
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<787c9189-9528-4a55-8462-8e924c68ff7cn@googlegroups.com> <7f3b51ea-1680-4d80-890b-28ac718d288fn@googlegroups.com>
<7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com> <02ddb9a9-880e-4ba7-b884-d0c0d837049fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e63b76a2-783f-4663-9c60-96ad2ffc9e47n@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: ahmed.me...@univ-bejaia.dz (Ahmed MELAHI)
Injection-Date: Fri, 10 Feb 2023 01:12:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 12823
 by: Ahmed MELAHI - Fri, 10 Feb 2023 01:12 UTC

Le jeudi 9 février 2023 à 13:17:53 UTC, Ahmed MELAHI a écrit :
> Le jeudi 9 février 2023 à 12:47:02 UTC, Ahmed MELAHI a écrit :
> > Le jeudi 9 février 2023 à 08:13:20 UTC, minf...@arcor.de a écrit :
> > > Ahmed MELAHI schrieb am Donnerstag, 9. Februar 2023 um 09:00:14 UTC+1:
> > > > > SENDMOREMONEY
> > > > Hi everybody,
> > > > Here is a program that gives all possible solutions (there are 25), written in gforth.
> > > Thanks! 25 solutions appear when M is allowed to be zero.
> > > Even more solutions appear when the all-digits-different constraint is taken out.
> > >
> > > I am fascinated by those many completely different approaches in this thread.
> > Hi,
> > For the case of m<>0 (so m must be 1), the same program gives the also the unique result, by selecting the solution with m=1.
> >
> > To get the unique result directly,one can set 1 to m, and search for the others.
> > Here is the program (the same as the previous, with some changes)
> > s" random.fs" included
> >
> > : not 0= ;
> >
> > 0 value s
> > 0 value e
> > 0 value n
> > 0 value d
> > 0 value m
> > 0 value o
> > 0 value r
> > 0 value y
> >
> > : send s 10 * e + 10 * n + 10 * d + ;
> > : more m 10 * o + 10 * r + 10 * e + ;
> > : money m 10 * o + 10 * n + 10 * e + 10 * y + ;
> >
> > : is_send+more=money_? send more + money - 0= ;
> >
> > create flags_chosen_vals 10 allot
> > flags_chosen_vals 10 erase
> >
> > create flags_chosen_sendmory 8 allot
> > flags_chosen_sendmory 8 erase
> >
> > : choose 10 random ;
> > : chosen flags_chosen_vals + 1 swap c! ;
> > : chosen_? flags_chosen_vals + c@ ;
> >
> > : chosen_var_set flags_chosen_sendmory + 1 swap c! ;
> > : chosen_var_get flags_chosen_sendmory + c@ ;
> >
> > : chosen--> dup chosen ;
> >
> > : chosen_vars_init flags_chosen_sendmory 8 erase ;
> > : chosen_vals_init flags_chosen_vals 10 erase ;
> >
> > : to_s choose chosen--> to s 0 chosen_var_set ;
> > : to_e choose dup chosen_? if drop else chosen--> to e 1 chosen_var_set then ;
> > : to_n choose dup chosen_? if drop else chosen--> to n 2 chosen_var_set then ;
> > : to_d choose dup chosen_? if drop else chosen--> to d 3 chosen_var_set then ;
> > : to_m choose dup chosen_? if drop else chosen--> to m 4 chosen_var_set then ;
> > : to_o choose dup chosen_? if drop else chosen--> to o 5 chosen_var_set then ;
> > : to_r choose dup chosen_? if drop else chosen--> to r 6 chosen_var_set then ;
> > : to_y choose dup chosen_? if drop else chosen--> to y 7 chosen_var_set then ;
> >
> > : gen_sendmory
> > chosen_vals_init
> > 1 chosen \ mark digit 1 as already chosen
> > chosen_vars_init
> > 4 chosen_var_set \ mark m as already chosen
> > 1 to m \ and set to 1
> > to_s
> > begin 1 chosen_var_get not while to_e repeat
> > begin 2 chosen_var_get not while to_n repeat
> > begin 3 chosen_var_get not while to_d repeat
> > \ begin 4 chosen_var_get not while to_m repeat
> > begin 5 chosen_var_get not while to_o repeat
> > begin 6 chosen_var_get not while to_r repeat
> > begin 7 chosen_var_get not while to_y repeat
> > ;
> >
> > : .sendmory s . e . n . d . m . o . r . y . ;
> >
> > : sendmory_as_number s 10 * e + 10 * n + 10 * d + 10 * m + 10 * o + 10 * r + 10 * y + ;
> >
> > 1000 value max_results_size
> > create results max_results_size cells allot
> > 0 value result_counter
> >
> > : to_results
> > sendmory_as_number
> > result_counter 0 ?do
> > dup i cells results + @ = if
> > drop unloop exit
> > then
> > loop
> > result_counter cells results + !
> > result_counter 1+ to result_counter
> > result_counter cr . ." solutions found"
> > ;
> >
> >
> > : go_sendmoremoney
> > cr
> > ." solving ..."
> > 0 to result_counter
> > 0 do
> > gen_sendmory
> > is_send+more=money_? if
> > ( cr .sendmory)
> > to_results
> > unloop exit
> > then
> > loop
> > cr cr result_counter . ." solutions found"
> > ;
> >
> > : .send send 4 .r ;
> > : .more more 4 .r ;
> > : .money money 5 .r ;
> >
> > : to_sendmory
> > 10000000 /mod to s
> > 1000000 /mod to e
> > 100000 /mod to n
> > 10000 /mod to d
> > 1000 /mod to m
> > 100 /mod to o
> > 10 /mod to r
> > to y
> > ;
> >
> >
> > : .send+more=money .send ." + " .more ." = " .money ;
> >
> > : .results
> > ." sol_num sendmory send + more = money"
> > result_counter 0 ?do
> > cr i 7 .r 3 spaces
> > i cells results + @ dup
> > . 3 spaces
> > to_sendmory .send+more=money
> > loop
> > ;
> > : .unique_result
> > cr ." The unique solution is:" cr
> > cr
> > ." send + more = money"
> > cr
> > result_counter 0 ?do
> > i cells results + @ dup
> > to_sendmory
> > m 1 = if
> > .send+more=money
> > unloop
> > exit
> > then
> > loop
> > ;
> >
> > : go go_sendmoremoney cr .unique_result ;
> >
> > 10000000 go
> >
> > bye
> Hi, again,
> In the previous program, there is a result left on the data stack. it must be dropped.
> The new version is here
> s" random.fs" included
>
> : not 0= ;
>
> 0 value s
> 0 value e
> 0 value n
> 0 value d
> 0 value m
> 0 value o
> 0 value r
> 0 value y
>
> : send s 10 * e + 10 * n + 10 * d + ;
> : more m 10 * o + 10 * r + 10 * e + ;
> : money m 10 * o + 10 * n + 10 * e + 10 * y + ;
>
> : is_send+more=money_? send more + money - 0= ;
>
> create flags_chosen_vals 10 allot
> flags_chosen_vals 10 erase
>
> create flags_chosen_sendmory 8 allot
> flags_chosen_sendmory 8 erase
>
> : choose 10 random ;
> : chosen flags_chosen_vals + 1 swap c! ;
> : chosen_? flags_chosen_vals + c@ ;
>
> : chosen_var_set flags_chosen_sendmory + 1 swap c! ;
> : chosen_var_get flags_chosen_sendmory + c@ ;
>
> : chosen--> dup chosen ;
>
> : chosen_vars_init flags_chosen_sendmory 8 erase ;
> : chosen_vals_init flags_chosen_vals 10 erase ;
>
> : to_s choose chosen--> to s 0 chosen_var_set ;
> : to_e choose dup chosen_? if drop else chosen--> to e 1 chosen_var_set then ;
> : to_n choose dup chosen_? if drop else chosen--> to n 2 chosen_var_set then ;
> : to_d choose dup chosen_? if drop else chosen--> to d 3 chosen_var_set then ;
> : to_m choose dup chosen_? if drop else chosen--> to m 4 chosen_var_set then ;
> : to_o choose dup chosen_? if drop else chosen--> to o 5 chosen_var_set then ;
> : to_r choose dup chosen_? if drop else chosen--> to r 6 chosen_var_set then ;
> : to_y choose dup chosen_? if drop else chosen--> to y 7 chosen_var_set then ;
>
> : gen_sendmory
> chosen_vals_init
> 1 chosen \ mark digit 1 as already chosen
> chosen_vars_init
> 4 chosen_var_set \ mark m as already chosen
> 1 to m \ and set to 1
>
> to_s
> begin 1 chosen_var_get not while to_e repeat
> begin 2 chosen_var_get not while to_n repeat
> begin 3 chosen_var_get not while to_d repeat
> \ begin 4 chosen_var_get not while to_m repeat
> begin 5 chosen_var_get not while to_o repeat
> begin 6 chosen_var_get not while to_r repeat
> begin 7 chosen_var_get not while to_y repeat
> ;
>
> : .sendmory s . e . n . d . m . o . r . y . ;
>
> : sendmory_as_number s 10 * e + 10 * n + 10 * d + 10 * m + 10 * o + 10 * r + 10 * y + ;
>
> 1000 value max_results_size
> create results max_results_size cells allot
> 0 value result_counter
>
> : to_results
> sendmory_as_number
> result_counter 0 ?do
> dup i cells results + @ = if
> drop unloop exit
> then
> loop
> result_counter cells results + !
> result_counter 1+ to result_counter
> result_counter cr . ." solutions found"
> ;
>
>
> : go_sendmoremoney
> cr
> ." solving ..."
> 0 to result_counter
> 0 do
> gen_sendmory
> is_send+more=money_? if
> ( cr .sendmory)
> to_results
> unloop exit
> then
> loop
> cr cr result_counter . ." solutions found"
> ;
>
> : .send send 4 .r ;
> : .more more 4 .r ;
> : .money money 5 .r ;
>
> : to_sendmory
> 10000000 /mod to s
> 1000000 /mod to e
> 100000 /mod to n
> 10000 /mod to d
> 1000 /mod to m
> 100 /mod to o
> 10 /mod to r
> to y
> ;
>
>
> : .send+more=money .send ." + " .more ." = " .money ;
>
> : .results
> ." sol_num sendmory send + more = money"
> result_counter 0 ?do
> cr i 7 .r 3 spaces
> i cells results + @ dup
> . 3 spaces
> to_sendmory .send+more=money
> loop
> ;
>
>
> : .unique_result
> cr ." The unique solution is:" cr
> cr
> ." send + more = money"
> cr
> result_counter 0 ?do
> i cells results + @
> to_sendmory
> m 1 = if
> .send+more=money
>
> unloop
> exit
> then
> loop
> ;
>
> : go go_sendmoremoney cr .unique_result ;
>
> 10000000 go
> \ -------N.B.---------
> utime 10000000 go utime d- dnegate d>f 1e-6 f* f. \ less than 1 second
Hi,
Previous program modified.


Click here to read the complete article
Re: SEND+MORE=MONEY

<874jrucnja.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: SEND+MORE=MONEY
Date: Thu, 09 Feb 2023 17:33:13 -0800
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <874jrucnja.fsf@nightsong.com>
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<87ttzvzmmb.fsf@nightsong.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at>
<87pmaiztp1.fsf@nightsong.com> <87h6vuzl8v.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="9e8385a1d607cf663d6463ca27b2b288";
logging-data="891780"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UwzZIDGtMWQhmN77EbfSH"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:ZF8+rZUjAtKA8FtgTjOnlQB7aiY=
sha1:ALeIBn5wcAYzwjmbp5tcOcsrdpU=
 by: Paul Rubin - Fri, 10 Feb 2023 01:33 UTC

Paul Rubin <no.email@nospam.invalid> writes:
> Here is the Haskell version. CPU time with ghc 8.8.4 -O3 is 0.472s sec
> so about 6x the speed of Python3 3.9 on my laptop.

Here is C++ version, same algorithm, gcc 10.2.1 with -O3, runtime 0.037
sec on same laptop. Look ma, no garbage collection.

================================================================

#include <algorithm>
#include <iostream>
#include <array>

int main() {
std::array<int,10> digits {0,1,2,3,4,5,6,7,8,9};
enum { x0, x1, s, e, n, d, m, o, r, y } ;

do {
if (digits[x0] > digits[x1] || digits[m] == 0)
continue;
int send = 1000*digits[s]+100*digits[e]+10*digits[n]+digits[d];
int more = 1000*digits[m]+100*digits[o]+10*digits[r]+digits[e];
int money = 10000*digits[m]+1000*digits[o]
+ 100*digits[n]+10*digits[e]+digits[y];
if (send + more == money)
std::cout << send << " " << more << " " << money << '\n';
} while(std::next_permutation(digits.begin(), digits.end()));
}

Re: SEND+MORE=MONEY

<cbf14347-dd14-4ec8-b689-83a9b34d6745n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:aa91:0:b0:71d:bbfe:6af0 with SMTP id t139-20020a37aa91000000b0071dbbfe6af0mr1242903qke.327.1676006102503;
Thu, 09 Feb 2023 21:15:02 -0800 (PST)
X-Received: by 2002:a0c:8ec8:0:b0:537:ab77:fbe9 with SMTP id
y8-20020a0c8ec8000000b00537ab77fbe9mr1217699qvb.42.1676006102309; Thu, 09 Feb
2023 21:15:02 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 9 Feb 2023 21:15:01 -0800 (PST)
In-Reply-To: <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=154.121.92.106; posting-account=KJSw4AoAAACRkUCek5r_78mFj6sHzH4C
NNTP-Posting-Host: 154.121.92.106
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<787c9189-9528-4a55-8462-8e924c68ff7cn@googlegroups.com> <7f3b51ea-1680-4d80-890b-28ac718d288fn@googlegroups.com>
<7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com> <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cbf14347-dd14-4ec8-b689-83a9b34d6745n@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: ahmed.me...@univ-bejaia.dz (Ahmed MELAHI)
Injection-Date: Fri, 10 Feb 2023 05:15:02 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 9958
 by: Ahmed MELAHI - Fri, 10 Feb 2023 05:15 UTC

Le jeudi 9 février 2023 à 14:24:39 UTC, minf...@arcor.de a écrit :
> Ahmed MELAHI schrieb am Donnerstag, 9. Februar 2023 um 13:47:02 UTC+1:
> > For the case of m<>0 (so m must be 1), the same program gives the also the unique result, by selecting the solution with m=1.
> Merci de tes contributions! Of course M has to be 1 because it has to be a carry bit.
> So you used a mathematical property of one of the constraints to manually reduce your search space.
>
> BTW this shows an interesting common aspect between all the various Forth proposals:
> In their manually coded program formulation they freely join/mix/meddle walking the search space with constraint properties.
> Therefore many different solutions appear on the table depending on programmer's expertise or preference.
>
> Declarative constraint programming languages don't have to do this (ideally). They go in distinctive not related steps:
> 1) declare the variable domains ( here: integers ranging from 0 to 9 )
> 2) span the search space in toto ( here: 8 variables SENDMORY )
> 3) declare the constraints ( here: M<>0 and SEND+MORE=MONEY and all variables unique)
> \ BTW: M<>0 not because of the other constraint but because otherwise MONEY would be written as ONEY ! )
> 4) solve it.
> ( of course real CLP programmers also use their optimization toolbelts .... but that's a different story )
>
> So this is a very generic and very versatile approach! One can add/delete/change constraints in one place without
> having to rewrite the program. And the best: bug-free from start.
>
> How would a Forth programmer come close to this?
>
> ( for fun: try to solve TO+GO=OUT )
Hi,
Here, 3 programs are presented:
-1- send+more=money: without using permutations, use all_diff defined here in the program, also note the definition of (sendmoremoney), it has the form of declarative constrained logic, using the words defined at the begining of the program. this program take a while to find the solution (due to absence of permutations).
-2- send+more=money: with use of permutations, also note the form of the word (sendmoremoney), it uses declarative constained logic using the words defined in the begining of the program. this program find the solution rapidly.
-3- to+go=out: as the first program, here there are just 4 unknowns. it find the solution rapidly.

N.B. the words defined at the begining can be moved to another program (module) and included in the application program.

First program:

s" random.fs" included

: :- 1 ;
: , and dup 0= if exit then ;
: min_max 1 -rot over - 1+ random + ;

100 value diff_flags_max_size
create all_diff_flags diff_flags_max_size allot

0 value nvars

: all_diff_flags_init all_diff_flags diff_flags_max_size erase ;

: all_diff
all_diff_flags_init
nvars 0 do
all_diff_flags + dup c@ if
nvars i - 0 do
drop
loop
0 unloop exit
else
1 swap c!
then
loop
1
;

: -: and if 1 cr ." solution found" else 0 then ;

\ here begins the application to send+more=money
8 to nvars

0 value s
0 value e
0 value n
0 value d
0 value m
0 value o
0 value r
0 value y

: (sendmoremoney)
:- 0 9 min_max to s , 0 9 min_max to e , 0 9 min_max to n , 0 9 min_max to d ,
0 9 min_max to m , 0 9 min_max to o , 0 9 min_max to r , 0 9 min_max to y ,
s e n d m o r y all_diff ,
m 0> ,
s 10 * e + 10 * n + 10 * d +
m 10 * o + 10 * r + 10 * e + +
m 10 * o + 10 * n + 10 * e + 10 * y + = -:
;

: sendmoremoney
cr ." Solving ..." cr

0 do
(sendmoremoney)
if 1 unloop exit else then
loop
0
;

: .solution
if
cr
." the solution is: "
cr
s 10 * e + 10 * n + 10 * d + 4 .r ." + "
m 10 * o + 10 * r + 10 * e + 4 .r ." = "
m 10 * o + 10 * n + 10 * e + 10 * y + 5 .r
else
cr
." no solution found"
then
cr
;

: go sendmoremoney .solution ;

\ 100000000 go

utime 100000000 go utime d- dnegate d>f 1e-6 f* cr ." Done in: " f. ." seconds."

Second program:
s" random.fs" included

: :- 1 ;
: , and dup 0= if exit then ;
: min_max 1 -rot over - 1+ random + ;

100 value diff_flags_max_size
create all_diff_flags diff_flags_max_size allot

0 value nvars

: all_diff_flags_init all_diff_flags diff_flags_max_size erase ;

: all_diff
all_diff_flags_init
nvars 0 do
all_diff_flags + dup c@ if
nvars i - 0 do
drop
loop
0 unloop exit
else
1 swap c!
then
loop
1
;

: -: and if 1 cr ." solution found" else 0 then ;

\ here begins the application to send+more=money

8 to nvars

0 value s
0 value e
0 value n
0 value d
0 value m
0 value o
0 value r
0 value y

\ s e n d m o r y : the 8 first positions
create vals 0 c, 1 c, 2 c, 3 c, 4 c, 5 c, 6 c, 7 c, 8 c, 9 c,

0 value a
0 value b

: gen_new_permutation
\ by exchanging values in vals at a and b positions,
\ a and b are randomly chosen in 0, ..., 9.
10 random to a
10 random to b
vals a + c@
vals b + c@
vals a + c!
vals b + c!
;

: gen_sendmory
1
gen_new_permutation
7 for vals i + c@ next
to s to e to n to d to m to o to r to y
;

: (sendmoremoney)
:- gen_sendmory ,
m 0> ,
s 10 * e + 10 * n + 10 * d +
m 10 * o + 10 * r + 10 * e + +
m 10 * o + 10 * n + 10 * e + 10 * y + = -:
;

: sendmoremoney
cr ." Solving ..." cr

0 do
(sendmoremoney)
if 1 unloop exit else then
loop
0
;

: .solution
if
cr
." the solution is: "
cr
s 10 * e + 10 * n + 10 * d + 4 .r ." + "
m 10 * o + 10 * r + 10 * e + 4 .r ." = "
m 10 * o + 10 * n + 10 * e + 10 * y + 5 .r
else
cr
." no solution found"
then
cr
;

: go sendmoremoney .solution ;

\ 10000000 go

utime 10000000 go utime d- dnegate d>f 1e-6 f* cr ." Done in: " f. ." seconds."

Third program:
s" random.fs" included

: :- 1 ;
: , and dup 0= if exit then ;
: min_max 1 -rot over - 1+ random + ;

100 value diff_flags_max_size
create all_diff_flags diff_flags_max_size allot

0 value nvars

: all_diff_flags_init all_diff_flags diff_flags_max_size erase ;

: all_diff
all_diff_flags_init
nvars 0 do
all_diff_flags + dup c@ if
nvars i - 0 do
drop
loop
0 unloop exit
else
1 swap c!
then
loop
1
;

: -: and if 1 cr ." solution found" else 0 then ;

\ here begins the application to to+go=out

4 to nvars

0 value t
0 value o
0 value g
0 value u

: (togoout)
:- 0 9 min_max to t , 0 9 min_max to o , 0 9 min_max to g , 0 9 min_max to u ,
t o g u all_diff ,
o 0> ,
t 10 * o +
g 10 * o + +
o 10 * u + 10 * t + = -:
;

: togoout
cr ." Solving ..." cr

0 do
(togoout)
if 1 unloop exit else then
loop
0
;

: .solution
if
cr
." the solution is: "
cr
t 10 * o + 2 .r ." + "
g 10 * o + 2 .r ." = "
o 10 * u + 10 * t + 3 .r
else
cr
." no solution found"
then
cr
;

: go togoout .solution ;

\ 100000000 go

utime 100000000 go utime d- dnegate d>f 1e-6 f* cr ." Done in: " f. ." seconds."

Re: SEND+MORE=MONEY

<2023Feb10.112157@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: SEND+MORE=MONEY
Date: Fri, 10 Feb 2023 10:21:57 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 32
Message-ID: <2023Feb10.112157@mips.complang.tuwien.ac.at>
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com> <787c9189-9528-4a55-8462-8e924c68ff7cn@googlegroups.com> <7f3b51ea-1680-4d80-890b-28ac718d288fn@googlegroups.com> <7df53e6f-b86c-49e2-ad41-e8debb3b3630n@googlegroups.com> <db56f336-1b38-4d40-a032-716db04d83afn@googlegroups.com> <2023Feb9.174406@mips.complang.tuwien.ac.at> <9ef3d369-4608-4e7e-9375-a3cce2bd245cn@googlegroups.com>
Injection-Info: reader01.eternal-september.org; posting-host="6c620496229d7b0154a807610273d14c";
logging-data="1078138"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19peJT7DiRn/zEVAuv909KU"
Cancel-Lock: sha1:PkT8wdBcyNf6sVwtCJcm9TYhOd4=
X-newsreader: xrn 10.11
 by: Anton Ertl - Fri, 10 Feb 2023 10:21 UTC

"minf...@arcor.de" <minforth@arcor.de> writes:
>We are trying to do things the Forth way and can't use labeling.

What in the Forth way would preclude us from using labeling?

>Still it can be done without labeling, look here
>https://www.swi-prolog.org/pldoc/man?section=clpfd-search

This page shows that SWI Prolog outputs the remaining constraints when
you give it only the original constraints (which is certainly much
better than the state of the art when I did my master's thesis). The
constraint solver can reduce the possible values of the variables even
so, basically:

S=9 E in 4..7 N in 5..8 D in 2..8
M=1 O=0 R in 2..8
Y in 2..8
91*E+D+10*R = 90*N+Y

It then needs some labeling to resolve the rest, even though there is
only one solution (so a sufficiently sophisticated solver could
produce a ground solution from the constraints alone without labeling;
with multiple solutions labeling or some other kind of guessing (e.g.,
splitting variable ranges) is strictly necessary). Still, the range
reduction of the existing SWI Prolog solver is quite impressive.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2022: https://euro.theforth.net

Re: SEND+MORE=MONEY

<2023Feb10.113948@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: SEND+MORE=MONEY
Date: Fri, 10 Feb 2023 10:39:48 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 29
Message-ID: <2023Feb10.113948@mips.complang.tuwien.ac.at>
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com> <87ttzvzmmb.fsf@nightsong.com> <2023Feb9.084758@mips.complang.tuwien.ac.at> <87pmaiztp1.fsf@nightsong.com> <87h6vuzl8v.fsf@nightsong.com>
Injection-Info: reader01.eternal-september.org; posting-host="6c620496229d7b0154a807610273d14c";
logging-data="1078138"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hBFRSEjNHMp+FuYkHOwAe"
Cancel-Lock: sha1:gATwFBMFbzlbOkHoatO82oV43Ao=
X-newsreader: xrn 10.11
 by: Anton Ertl - Fri, 10 Feb 2023 10:39 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>Paul Rubin <no.email@nospam.invalid> writes:
>> I will try the same thing in Haskell when I get a chance, and also
>> try to figure out what is going wrong in my Forth version.
>
>Here is the Haskell version. CPU time with ghc 8.8.4 -O3 is 0.472s sec
>so about 6x the speed of Python3 3.9 on my laptop. In both cases there
>are obvious optimizations possible at the expense of complicating the
>code slightly, such as generating only half the permutations instead
>of throwing away the ones with x0>=x1.

The question is if you can use Haskell's lazy evaluation to advantage
here, resulting in a similar effect (although conceptually inverted)
as the interleaving of labeling and constraint evaluation that happens
in constraint logic programming. I don't expect a sophisticated
solver for the big arithmetic constraint, but the x0<x1 and m>0
constraints might be able to reduce the time needed to produce the
permutations.

However, given that your C++ solution is a lot faster and cannot
benefit from lazy evaluation, I expect that the potential lazy
evaluation advantage does not happen in this Haskell program.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2022: https://euro.theforth.net

Re: SEND+MORE=MONEY

<nnd$70d5b09f$5704b69c@cca0e852862b3a02>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com> <2023Feb9.084758@mips.complang.tuwien.ac.at> <138b28de-6f2a-449b-9279-629f3c17a03bn@googlegroups.com> <2023Feb9.115420@mips.complang.tuwien.ac.at>
Subject: Re: SEND+MORE=MONEY
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$70d5b09f$5704b69c@cca0e852862b3a02>
Organization: KPN B.V.
Date: Fri, 10 Feb 2023 12:44:34 +0100
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe006.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 29
Injection-Date: Fri, 10 Feb 2023 12:44:34 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2059
 by: none - Fri, 10 Feb 2023 11:44 UTC

In article <2023Feb9.115420@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
<SNIP>
>Plus, in a really good native-code Forth system (beyond what current
>Forth systems do), locals will also be more efficient, because they
>can be kept in registers, while global variables have to be stored
>into memory.

I hope to demonstrate that VARIABLE can be optimised away as easily
as locals.
Also there is a false dichotomy (cause by the LOCAL mindset)
between local and global variables.
In a proper Pascal implementation of qsort there is an intermediate
storage where e.g. the pointers to procedures are stored.
They are global to qsort proper, and local to the main program.
It is almost impossible to break out of the mindset of
language like c and Forth that cannot have local functions that
have their own variables. (So I don't blame you ;-) )

>
>- anton

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: SEND+MORE=MONEY

<0904a12a-cdde-4c21-a4a6-422ee2bd8ad1n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5e51:0:b0:3a8:179f:b1ba with SMTP id i17-20020ac85e51000000b003a8179fb1bamr2694096qtx.47.1676030843577;
Fri, 10 Feb 2023 04:07:23 -0800 (PST)
X-Received: by 2002:ac8:57c2:0:b0:3a9:82a1:4f6 with SMTP id
w2-20020ac857c2000000b003a982a104f6mr1921986qta.117.1676030843381; Fri, 10
Feb 2023 04:07:23 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Fri, 10 Feb 2023 04:07:23 -0800 (PST)
In-Reply-To: <nnd$70d5b09f$5704b69c@cca0e852862b3a02>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f2e:e9a4:a1fe:e600:8889:e2a3;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f2e:e9a4:a1fe:e600:8889:e2a3
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at> <138b28de-6f2a-449b-9279-629f3c17a03bn@googlegroups.com>
<2023Feb9.115420@mips.complang.tuwien.ac.at> <nnd$70d5b09f$5704b69c@cca0e852862b3a02>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0904a12a-cdde-4c21-a4a6-422ee2bd8ad1n@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Fri, 10 Feb 2023 12:07:23 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2574
 by: minf...@arcor.de - Fri, 10 Feb 2023 12:07 UTC

none albert schrieb am Freitag, 10. Februar 2023 um 12:44:37 UTC+1:
> In article <2023Feb...@mips.complang.tuwien.ac.at>,
> Anton Ertl <an...@mips.complang.tuwien.ac.at> wrote:
> <SNIP>
> >Plus, in a really good native-code Forth system (beyond what current
> >Forth systems do), locals will also be more efficient, because they
> >can be kept in registers, while global variables have to be stored
> >into memory.
> I hope to demonstrate that VARIABLE can be optimised away as easily
> as locals.
> Also there is a false dichotomy (cause by the LOCAL mindset)
> between local and global variables.
> In a proper Pascal implementation of qsort there is an intermediate
> storage where e.g. the pointers to procedures are stored.
> They are global to qsort proper, and local to the main program.
> It is almost impossible to break out of the mindset of
> language like c and Forth that cannot have local functions that
> have their own variables. (So I don't blame you ;-) )

Pascal also allows nested functions and afaik even closures. Both are not available
in C until today (without extreme clumsy trick programming). Were it not for its
verbose syntax, it could kick C around more often than not.

Re: SEND+MORE=MONEY

<87zg9lbbwb.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: SEND+MORE=MONEY
Date: Fri, 10 Feb 2023 10:42:12 -0800
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <87zg9lbbwb.fsf@nightsong.com>
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<87ttzvzmmb.fsf@nightsong.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at>
<87pmaiztp1.fsf@nightsong.com> <87h6vuzl8v.fsf@nightsong.com>
<2023Feb10.113948@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="9e8385a1d607cf663d6463ca27b2b288";
logging-data="1190635"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rzLLWicD+erz1jB7tPxME"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:vOMAI8fGLqRUg//MC7w6AfDZR6k=
sha1:aJw1yXyNfaGR4wVLy/3c2EjDMds=
 by: Paul Rubin - Fri, 10 Feb 2023 18:42 UTC

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> I don't expect a sophisticated solver for the big arithmetic
> constraint, but the x0<x1 and m>0 constraints might be able to reduce
> the time needed to produce the permutations.

Certainly that would have been straightforward if the permutations were
being generated in a known order, say lexicographic. I didn't bother
checking the docs and just assumed they were in random order so I had to
filter all of them. The Haskell version was a straightforward port of
the Python version, whose itertools.permutations generator also doesn't
generate a documented order. Both versions use lazy evaluation in the
sense that the permutation generation is interleaved with the checking,
rather than building up a list of 10! permutations in memory before
filtering.

The C++ std::next_permutation function on the other hand is documented
to generate permutations in lexicographic order. It works by taking an
existing permutation and "incrementing" it. I didn't check the
implementation code but after a few minutes I was able to figure out how
it could work. I hadn't previously thought of that approach, which is
quite clever. My Forth version used recursion to generate permutations
on the stack. I think I will refactor it to use the C++ approach.

With the permutations generated in lexicographic order, it's just a
matter of putting m=1 in the leftmost cell and starting from there to
eliminate half the permutations.

There are some SMT solver solutions at page 276 of this nice book on
using solvers (15MB pdf, page 279 of the pdf):

https://yurichev.com/writings/SAT_SMT_by_example.pdf

It links to this, which might also be interesting (I haven't checked):

https://tamura70.gitlab.io/web-puzzle/cryptarithm/

Unfortunately it doesn't give solution timings.

Re: SEND+MORE=MONEY

<13bdf721-89ad-498e-9369-41b7f4294976n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:453:b0:3b9:b54b:d347 with SMTP id o19-20020a05622a045300b003b9b54bd347mr2757961qtx.246.1676060531057;
Fri, 10 Feb 2023 12:22:11 -0800 (PST)
X-Received: by 2002:a0c:cc10:0:b0:56c:29f:be50 with SMTP id
r16-20020a0ccc10000000b0056c029fbe50mr1372075qvk.50.1676060530757; Fri, 10
Feb 2023 12:22:10 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Fri, 10 Feb 2023 12:22:10 -0800 (PST)
In-Reply-To: <0904a12a-cdde-4c21-a4a6-422ee2bd8ad1n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=92.99.229.176; posting-account=mkOgdwoAAAAGDUBcY0S_1Gob1TR-ZY2T
NNTP-Posting-Host: 92.99.229.176
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at> <138b28de-6f2a-449b-9279-629f3c17a03bn@googlegroups.com>
<2023Feb9.115420@mips.complang.tuwien.ac.at> <nnd$70d5b09f$5704b69c@cca0e852862b3a02>
<0904a12a-cdde-4c21-a4a6-422ee2bd8ad1n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <13bdf721-89ad-498e-9369-41b7f4294976n@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: amal...@gmail.com (Ala'a)
Injection-Date: Fri, 10 Feb 2023 20:22:11 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3106
 by: Ala'a - Fri, 10 Feb 2023 20:22 UTC

Another solution using the same method by Wirth in nqueen problem (backtracking was called)

VOCABULARY smm ALSO smm DEFINITIONS

\ S E N D
\ + M O R E
\ ---------
\ M O N E Y

: 1array CREATE /ALLOT DOES> + ;

8 1array letter
: S ( -- a ) 0 letter ;
: E ( -- a ) 1 letter ;
: N ( -- a ) 2 letter ;
: D ( -- a ) 3 letter ;
: M ( -- a ) 4 letter ;
: O ( -- a ) 5 letter ;
: R ( -- a ) 6 letter ;
: Y ( -- a ) 7 letter ;

: d+e D C@ E C@ + ;
: d+e=y d+e 10 MOD Y C@ = ;
: c1 d+e 10 / ;
: n+r N C@ R C@ + ; : c2 n+r 10 / ;
: c1+n+r=e c1 n+r + 10 MOD E C@ = ;
: e+o E C@ O C@ + ; : c3 e+o 10 / ;
: c2+e+o=n c2 e+o + 10 MOD N C@ = ;
: s+m S C@ M C@ + ; : c4 s+m 10 / ;
: c3+s+m=o c3 s+m + 10 MOD O C@ = ;
: m<>0 M C@ c4 = M C@ 0<> AND ;
: solution d+e=y c1+n+r=e AND c2+e+o=n AND c3+s+m=o AND m<>0 AND ;

10 1array digits

: unused ( d - t/f ) digits C@ 0= ; \ safe or unused
: mark ( l d -- ) 1 OVER digits C! SWAP letter C! ;
: unmark ( l d -- ) 0 SWAP digits C! 0 SWAP letter C! ;

VARIABLE tries#

: .digits ( -- ) 7 0 DO I letter C@ . LOOP ;
: .solution1 CR ." After tries: " tries# @ . ." Solution is: " .digits ;
: .send ( -- ) S C@ . E C@ . N C@ . D C@ . ;
: .more ( -- ) M C@ . O C@ . R C@ . E C@ . ;
: .money ( -- ) M C@ . O C@ . N C@ . E C@ . Y C@ . ;
: .solution2 ( -- ) CR CR SPACE SPACE .send CR SPACE SPACE .more CR ." + _ _ _ _" CR .money ;
: check ( -- ) solution IF .solution2 THEN ;

: try ( l -- )
10 0 DO \ Digits \ I digit
tries# ++ \ CR tries# ? .digits
I unused IF
DUP I mark
DUP 7 < IF DUP 1+ RECURSE ELSE check THEN
DUP I unmark
THEN
LOOP DROP ;

: go 0 tries# ! 0 try ; go tries# ?

..S KEY BYE

It is not optimized and gets the solution.

Re: SEND+MORE=MONEY

<398ed97d-aeb5-4717-80c6-873b43f0afe0n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:7d94:0:b0:3b9:b43c:5db0 with SMTP id c20-20020ac87d94000000b003b9b43c5db0mr2502740qtd.132.1676071551349;
Fri, 10 Feb 2023 15:25:51 -0800 (PST)
X-Received: by 2002:a0c:f592:0:b0:56e:958a:97d2 with SMTP id
k18-20020a0cf592000000b0056e958a97d2mr223217qvm.27.1676071551203; Fri, 10 Feb
2023 15:25:51 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Fri, 10 Feb 2023 15:25:51 -0800 (PST)
In-Reply-To: <13bdf721-89ad-498e-9369-41b7f4294976n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f18:6d00:dcdf:6317:e078:db2a;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f18:6d00:dcdf:6317:e078:db2a
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at> <138b28de-6f2a-449b-9279-629f3c17a03bn@googlegroups.com>
<2023Feb9.115420@mips.complang.tuwien.ac.at> <nnd$70d5b09f$5704b69c@cca0e852862b3a02>
<0904a12a-cdde-4c21-a4a6-422ee2bd8ad1n@googlegroups.com> <13bdf721-89ad-498e-9369-41b7f4294976n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <398ed97d-aeb5-4717-80c6-873b43f0afe0n@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Fri, 10 Feb 2023 23:25:51 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1874
 by: Marcel Hendrix - Fri, 10 Feb 2023 23:25 UTC

On Friday, February 10, 2023 at 9:22:12 PM UTC+1, Ala'a wrote:
> Another solution using the same method by Wirth in nqueen problem (backtracking was called)
[..]
> It is not optimized and gets the solution.

Not bad, only 1 unfamiliar word ( /allot ), and runs in 14.84 ms ( iForth64 ).

FORTH> go

9 5 6 7
1 0 8 5
+ _ _ _ _
1 0 6 5 2 14.83 milliseconds elapsed, tries# = 7921010 ok

-marcel

Re: SEND+MORE=MONEY

<35c28391-dd19-467d-bc3f-8b2e39aa1a7an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:453:b0:3b9:b54b:d347 with SMTP id o19-20020a05622a045300b003b9b54bd347mr2950716qtx.246.1676100065590;
Fri, 10 Feb 2023 23:21:05 -0800 (PST)
X-Received: by 2002:a0c:cc10:0:b0:56c:29f:be50 with SMTP id
r16-20020a0ccc10000000b0056c029fbe50mr1440501qvk.50.1676100065344; Fri, 10
Feb 2023 23:21:05 -0800 (PST)
Path: i2pn2.org!rocksolid2!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Fri, 10 Feb 2023 23:21:04 -0800 (PST)
In-Reply-To: <398ed97d-aeb5-4717-80c6-873b43f0afe0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=92.99.229.176; posting-account=mkOgdwoAAAAGDUBcY0S_1Gob1TR-ZY2T
NNTP-Posting-Host: 92.99.229.176
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at> <138b28de-6f2a-449b-9279-629f3c17a03bn@googlegroups.com>
<2023Feb9.115420@mips.complang.tuwien.ac.at> <nnd$70d5b09f$5704b69c@cca0e852862b3a02>
<0904a12a-cdde-4c21-a4a6-422ee2bd8ad1n@googlegroups.com> <13bdf721-89ad-498e-9369-41b7f4294976n@googlegroups.com>
<398ed97d-aeb5-4717-80c6-873b43f0afe0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <35c28391-dd19-467d-bc3f-8b2e39aa1a7an@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: amal...@gmail.com (Ala'a)
Injection-Date: Sat, 11 Feb 2023 07:21:05 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2027
 by: Ala'a - Sat, 11 Feb 2023 07:21 UTC

On Saturday, February 11, 2023 at 3:25:52 AM UTC+4, Marcel Hendrix wrote:
> On Friday, February 10, 2023 at 9:22:12 PM UTC+1, Ala'a wrote:
> > Another solution using the same method by Wirth in nqueen problem (backtracking was called)
> [..]
> > It is not optimized and gets the solution.
> Not bad, only 1 unfamiliar word ( /allot ), and runs in 14.84 ms ( iForth64 ).
>
> FORTH> go
>
> 9 5 6 7
> 1 0 8 5
> + _ _ _ _
> 1 0 6 5 2 14.83 milliseconds elapsed, tries# = 7921010 ok
>
> -marcel

/Allot is combination of ALLOT and 0 FILL

Re: SEND+MORE=MONEY

<028614b0-498d-49d5-be7e-c37accf0fdb6n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:458e:0:b0:706:5055:fa2c with SMTP id s136-20020a37458e000000b007065055fa2cmr1382258qka.292.1676101781126;
Fri, 10 Feb 2023 23:49:41 -0800 (PST)
X-Received: by 2002:a05:622a:1646:b0:3b9:a423:ee4b with SMTP id
y6-20020a05622a164600b003b9a423ee4bmr2910941qtj.94.1676101780910; Fri, 10 Feb
2023 23:49:40 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Fri, 10 Feb 2023 23:49:40 -0800 (PST)
In-Reply-To: <35c28391-dd19-467d-bc3f-8b2e39aa1a7an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f18:6d00:dcdf:6317:e078:db2a;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f18:6d00:dcdf:6317:e078:db2a
References: <78cfcd0a-5bc4-4584-8a92-9e8005a0e306n@googlegroups.com>
<2023Feb9.084758@mips.complang.tuwien.ac.at> <138b28de-6f2a-449b-9279-629f3c17a03bn@googlegroups.com>
<2023Feb9.115420@mips.complang.tuwien.ac.at> <nnd$70d5b09f$5704b69c@cca0e852862b3a02>
<0904a12a-cdde-4c21-a4a6-422ee2bd8ad1n@googlegroups.com> <13bdf721-89ad-498e-9369-41b7f4294976n@googlegroups.com>
<398ed97d-aeb5-4717-80c6-873b43f0afe0n@googlegroups.com> <35c28391-dd19-467d-bc3f-8b2e39aa1a7an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <028614b0-498d-49d5-be7e-c37accf0fdb6n@googlegroups.com>
Subject: Re: SEND+MORE=MONEY
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Sat, 11 Feb 2023 07:49:41 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2016
 by: Marcel Hendrix - Sat, 11 Feb 2023 07:49 UTC

On Saturday, February 11, 2023 at 8:21:06 AM UTC+1, Ala'a wrote:
> On Saturday, February 11, 2023 at 3:25:52 AM UTC+4, Marcel Hendrix wrote:
> > On Friday, February 10, 2023 at 9:22:12 PM UTC+1, Ala'a wrote:
> > > Another solution using the same method by Wirth in nqueen problem (backtracking was called)
[..]
> /Allot is combination of ALLOT and 0 FILL

I found out when trying to run the program more than once.

-marcel


devel / comp.lang.forth / Re: SEND+MORE=MONEY

Pages:12345
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor