Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Save yourself from the 'Gates' of hell, use Linux." -- like that one. -- The_Kind @ LinuxNet


devel / comp.lang.forth / Re: Sorting

SubjectAuthor
* SortingRobert L.
+- Re: SortingJali Heinonen
`- Re: SortingS Jack

1
Sorting

<t003me$v8$1@gioia.aioe.org>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!FJv/bGwhGSz/196zv+MMkA.user.46.165.242.75.POSTED!not-for-mail
From: No_spamm...@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.forth
Subject: Sorting
Date: Sat, 5 Mar 2022 16:38:40 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <t003me$v8$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="1000"; posting-host="FJv/bGwhGSz/196zv+MMkA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: XanaNews/1.18.1.6
X-Notice: Filtered by postfilter v. 0.9.2
 by: Robert L. - Sat, 5 Mar 2022 16:38 UTC

Gauche Scheme:

(sort '(3 2 8 0 5) <)
===>
(0 2 3 5 8)

The sort function can be given a "key" function
that will be applied to each element before it
is compared to another element:

(sort '((a 3) (b 2) (c 8) (d 0) (e 5)) < cadr)
===>
((d 0) (b 2) (a 3) (e 5) (c 8))

The function "cadr" is equivalent to
(car (cdr ...)). It yields the second element
of a list.

Let's see how this would be done in Forth.

Re: Sorting

<87ef48ac-5fc5-41f3-b3d0-eeff294b5ec4n@googlegroups.com>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:5dca:0:b0:435:3eb2:7bd4 with SMTP id m10-20020ad45dca000000b004353eb27bd4mr3145081qvh.24.1646501937256;
Sat, 05 Mar 2022 09:38:57 -0800 (PST)
X-Received: by 2002:ad4:5768:0:b0:435:7924:24fb with SMTP id
r8-20020ad45768000000b00435792424fbmr819598qvx.37.1646501936979; Sat, 05 Mar
2022 09:38:56 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Mar 2022 09:38:56 -0800 (PST)
In-Reply-To: <t003me$v8$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=37.33.244.247; posting-account=kiOBZQoAAADFsAs31ZHaefxTuQxv84Wm
NNTP-Posting-Host: 37.33.244.247
References: <t003me$v8$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <87ef48ac-5fc5-41f3-b3d0-eeff294b5ec4n@googlegroups.com>
Subject: Re: Sorting
From: jali.hei...@gmail.com (Jali Heinonen)
Injection-Date: Sat, 05 Mar 2022 17:38:57 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 27
 by: Jali Heinonen - Sat, 5 Mar 2022 17:38 UTC

lauantai 5. maaliskuuta 2022 klo 18.38.45 UTC+2 Robert L. kirjoitti:
> Gauche Scheme:
>
> (sort '(3 2 8 0 5) <)
> ===>
> (0 2 3 5 8)
>
> The sort function can be given a "key" function
> that will be applied to each element before it
> is compared to another element:
>
> (sort '((a 3) (b 2) (c 8) (d 0) (e 5)) < cadr)
> ===>
> ((d 0) (b 2) (a 3) (e 5) (c 8))
>
> The function "cadr" is equivalent to
> (car (cdr ...)). It yields the second element
> of a list.
>
> Let's see how this would be done in Forth.

These are kind of meaningless but with 8th it's not much more work:

[3,2,8,0,5] ' n:cmp a:sort . cr
[["a",3],["b",2],["c",8],["d",0],["e",5]] ( 1 a:@ nip swap 1 a:@ nip swap n:cmp ) a:sort . cr

But the question is can you do something like this with Gauche Scheme?: https://www.dropbox.com/s/l1tbsi86si8aywn/platf.png?dl=0

Re: Sorting

<284578d5-fd99-4497-b340-eac221db4b6an@googlegroups.com>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:a558:0:b0:67b:1141:4754 with SMTP id o85-20020a37a558000000b0067b11414754mr800727qke.328.1646510365626;
Sat, 05 Mar 2022 11:59:25 -0800 (PST)
X-Received: by 2002:a05:6214:2aaa:b0:435:4b9a:b50f with SMTP id
js10-20020a0562142aaa00b004354b9ab50fmr3373088qvb.16.1646510365451; Sat, 05
Mar 2022 11:59:25 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Mar 2022 11:59:25 -0800 (PST)
In-Reply-To: <t003me$v8$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:823:6aca:8661:b905;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:823:6aca:8661:b905
References: <t003me$v8$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <284578d5-fd99-4497-b340-eac221db4b6an@googlegroups.com>
Subject: Re: Sorting
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Sat, 05 Mar 2022 19:59:25 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 42
 by: S Jack - Sat, 5 Mar 2022 19:59 UTC

On Saturday, March 5, 2022 at 10:38:45 AM UTC-6, Robert L. wrote:
>
> The sort function can be given a "key" function
> that will be applied to each element before it
> is compared to another element:
>
) frogd
ELF32X86_64 Frog Version 1.0d

co:start
-- IPC:HR: 5
-- IPC:HW: 4
-- CO:PID: 997
-- COPROC ready ok
asc ; ' s dfa ! ok
cr s ls -1L /usr/share/zoneinfo/Indian ; /sys
Antananarivo
Chagos
Christmas
Cocos
Comoro
Kerguelen
Mahe
Maldives
Mauritius
Mayotte
Reunion
ok
cr s ls -1L /usr/share/zoneinfo/Indian|sort -k1.3 ; /sys
Chagos
Cocos
Mahe
Maldives
Comoro
Kerguelen
Christmas
Antananarivo
Reunion
Mauritius
Mayotte
ok
--
me

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor