[ prog / sol / mona ]

prog


Favorite Lisp dialect?

1 2024-02-18 22:34

What is your favorite Lisp dialect?

2 2024-02-19 00:16 *

mit scheme
you dont belong here go back

3 2024-02-19 03:01

>>2

mit scheme is my favorite too though lol

4 2024-02-19 06:10

mit scheme

5 2024-02-19 11:38

lisp is a jewish lang. use forth instead.

6 2024-02-19 20:56

mit scheme

7 2024-02-24 08:05

(((LISP)))

8 2024-02-25 16:12 *

>>7
shut

9 2024-02-26 19:36

Clojure.

10 2024-02-27 04:36 *

>>9
shut

11 2024-02-27 04:37

kawa on my british sun box

12 2024-02-27 05:37

Common Lisp has a thriving ecosystem with stuff like SBCL and Trial. Clojure has everything on the JVM. There's something to be said for all that. Doesn't make them my favorites, but there's something to it.

Janet seems like an interesting direction for Lisp dialects but my sense is that nobody else agrees, and I don't like the language enough to defend it.

Scheme is very special, and also so fucking frustrating. I wish I still liked it as much as I used to, but in those days I hadn't developed a taste for pragmatism. I'm looking into coming back to it, and wondering whether I'll find it sitting there at the dinner table to tell me, "Welcome home, cheater."

13 2024-02-27 05:43 *

>>12
shut

Common Lisp has a thriving ecosystem with stuff like SBCL and Trial.

slib and related projects no sauce for cheaters
everything about racket and chicken

Clojure has everything on the JVM
doesnt know kawa must keep cheating

go back to dqn /prog/

I don't like the x enough to seriously defend it.

this is me dont reply to spoilers like this ever again

14 2024-02-27 06:04

>>13

no sauce for cheaters

Too late I found it anyway

15 2024-02-27 06:07 *

>>14
slib is an incomplete example of something from the past
there are projects like it now

16 2024-02-27 06:22 *

well rephrasing where this trap was created
you can still use it but its not exactly thriving anymore unlike the alternatives https://lists.gnu.org/archive/html/slib-discuss/
one of the nice things about scheme is being able to use code back to the r4rs era and most of the time further

17 2024-02-27 08:10

Like lambda-native?

18 2024-02-27 08:28 *

that is a different type of portability and calling scheme just functional is already worrying
if you are fine with being stuck with gambit it isnt an issue but its another i dont know how to use words and cover up with buzzwords type of deal
id be scared to use it unless i was a contributor that knew the codebase well

19 2024-02-27 08:58 *

more on it since im unsure how much you know and you are putting the effort in
gambit is medicore
if it wasnt for falling into a bunch of edge cases where i end up having to read into gambits system directory full of slds and #.scms for gambit specific procedures and the (help) procedure trying to make network connections especially to an unreachable site i would say its somewhat good
if you can cope with it you can run with it and lambda-native shouldnt be an issue since its issues will be similar judging by the wording and open issues

20 2024-02-27 20:01

lips licker, i just like to lick lips.

21 2024-02-27 22:50 *

>>20
kinda gay and not expert programmer tier

22 2024-02-27 22:54

mit scheme

23 2024-03-01 05:40 *

gerbil

24 2024-03-02 16:41 *

I like Emacs Lisp more than CL in a lot of ways.

25 2024-03-06 17:43

>>24
It's gotten much better the past few years. I used to find it downright intolerable, as bad as C.

26 2024-03-07 22:31 *

GNU Ubiquitous Intelligent Language for Extensions (ノ>ω<)ノ :。・::・゚’★,。・::・゚’☆

27 2024-03-09 13:54

mit litph

28 2024-03-10 09:14

Symta.

my personal lisp dialect.

Symta is a paradigm shifting dialect of Lisp programming language. Symta features succinct syntax, geared towards list-processing. Symta is an acronym, standing for SYMbolic compuTAtion language. As a Lisp system, Symta supports macros, eval and everything one would expect from a Lisp based language.

Symta allows performing advanced operations on lists and trees in a few lines of code. Usually it takes more words to loosely describe the task than to precisely implement it. Symta allows very tight code. Something as complex as a macro-processor could be implemented in a few characters of Symta code:

Data name!\Nancy age!37 city!\Amsterdam
Form "Hi! My name is %name%, I'm %age% years old and I live in %city%."
say Form{@"%[V]%"=Data.V}

The code doing macros substitution `{@"%[V]%"=Data.V}` is minuscule 18 chars, yet does something which usually requires hundreds of fail-prone C/C++ lines. And List{Map} is not even a special syntax, compared to Perl's regexps, but something general purpose, used everywhere for looping over data, structured or unstructured.

If we just want to collect all the `%variables%` used in the form, we can simply write

Form{@"%[&~r._]%"=} //produces (name age city) list

Symta allows doing the reverse too, and data can easily be parsed out of text.

Form "Hi! My name is Nancy, I'm 37 years old and I live in Amsterdam."
say Form("Hi! My name is [~], I'm [~] years old and I live in [~].")

Or, if you want to be explicit,

say Form("Hi! My name is [Name], I'm [Age] years old and I live in [City]."
      =: Name Age City)

Or more complex repetitive processing:

[:9](0:N@R=N+R^r) //sum integers 1 to 9, using recursion
[:9]{&~s+?} same as above, but using the `map` operator
[:9](1:N@R=N*R^r) //multiply integers 1 to 9, using recursion
[:9]{&~s^1*?} //same as above, but using the `map` operator
E '((b*2)-4*a*c)*0.5'
E{n~:'('=n~+;')'=n~-} //parenthesis levels across the expression E
L: a 3 b 3 a 5
L{T~.?+>0!=} //remove duplicate elements from the list L (a 3 b 5)
T{d? = ~~} //In text T replace each digit's occurence with its position
           //'1-a, 2-b and 3-c'{d? = ~~} => '0-a, 5-b and 13-c'
Path(_:"[A]/[B]"=A@r^B) //split Path into '/'-delimited components
Tree(_:H@T=@H^r@T^r;=:) //flatten `Tree` into a leaf list
Tree(:H@T=H^r@T^r;=:;hate=\love) //replace all occurrences of `hate`
                                 //with `love`, recursively
Tree(:_^r@_^r;&~r._<{?>100}<int?) //walk Tree recursively
                                  //collect integers larger than 100 as list
qsort@r H,@T = @T{:<H}^r,H,@T{<H=}^r //Hoare's quick sort algorithm

The above ``qsort`` example beats in brevity even the kings of conciseness - APL and J:

qsort=: (($:@(<#[), (=#[), $:@(>#[)) ({~ ?@#)) ^: (1<#)

Yet, compared to J, Symta's ``qsort`` is arguably more readable than Haskell's version:

qsort [] = []
qsort (x:xs) = qsort [y | y <- xs, y < x] ++ [x] ++ qsort [y | y <- xs, y >= x]

Do you know "Fizzbuzz", a famous assignment from the programming interviews? For numbers up to 100,
- If the number is divisible by 3, print "Fizz"
- If the number is divisible by 5, print "Buzz"
- If the number is divisible by both 3 and 5, print "FizzBuzz"
- If the number is not divisible by 3 or 5, print the number

A good solution in Symta would be:

[:100]{~?%15=\FizzBuzz;~?%3=\Fizz;~?%5=\Buzz}

The solution in J again gets pretty close in brevity:

FB=:((0 i.~15 3 5|]){::'FizzBuzz';'Fizz';'Buzz';":)"0
FB i.100

I really love J, despite it being rather messy and unreadable. Yet write-only code can be designed in Symta too:

[:100]{?(\Fizz:?%3=)+?(\Buzz:?%5="")||?}

Or even:

[:100]{\Fizz*%(?%3)+\Buzz*%(?%5)||?}

Here we shaved a few characters, exploiting the fact that "FizzBuzz" is made out of "Fizz" and "Buzz", using the quirks in `||` and `+` behaviour, which weren't originally intended for that. If in future "FizzBuzz" changes to "HerpDerp", while "Fizz" and "Buzz" remain, we will have hard time modifying such convoluted code, compared to a straightforward case analysis. And it is easy to confuse somebody even with a single line of code. Consider the below version of FizzBuzz

[:100]{[\FizzBuzz\Buzz\Fizz ?][(?%5>0)*2+(?%3>0)]}

This one uses deep arithmetic wizardry for no good reason, so any reader with below savant math skills will stumble on it. And even savants wont immediately see that say `Fizz` corresponds to divisibility by 3. Fortunately the pattern matching nature of Symta guides programmer towards the plain and simple case analysis.

29 2024-03-10 09:15

Symta is very uniform and uses a single construct for what other languages have multiple functions or syntax constructs, or don't have an easy way to do at all.

L{:P} //keep elements matching pattern P
L{P=} //skip elements matching P
L{P=Body} //map elements matching P
L{~/3} //group list elements into lists of 3
L(:@_ P@) //check if list has an element matching P
L(:@_ -P&=0) //check if all list elements match P
L(/~ P@) //index of the element matching P
L(@_ ~<P@) //return the element matching P
L(/N@~) //drop first N elements
L(@~ /M) //drop last M elements
L(/N @~ /M) //drop first N elements and last M elements
L(~@) //first element of a list
L(_@~) //all list elements but the first.
L{/3=@Q.f} //change color order; same as L{R G B = B G R} 
L{/3=Q.z/3}  //convert to 8-bit grayscale; same as L{R G B = (R+G+B)/3}
L{/3&=Q.z/3..3} //convert to 24-bit grayscale
P{'/'='\\'} //'/usr/bin/bash' turns into '\usr\bin\bash'
P{@'usr'='usr/local'} //'/usr/bin/bash' turns into '/usr/local/bin/bash'
L{R G B = ~r.R ~g.G ~b.B} //split colors into separate planes
L{&~s+?} //sum elements of a list
L{:~a._,~b._} //split a list of pairs into two separate lists
L{:~a._,~b.(i~+)} //as above, but 2nd list gets integers from 0
Matrix: 1,2,3 4,5,6 7,8,9
Matrix{?.~~} // list diagonal elements of Matrix: 1,5,9
Matrix{&~s+?.~~} // sum diagonal elements of Matrix: 1+5+9
FilePath.lines{"[~~] [?]"^say} //print text file with each line prefixed by
                               //its number
S{~D.?+} //count character frequencies into the table bound to `~D`
         //return that table
L{?%2=~i+} //count the number of odd integers
L{~j+:?%2=~i+} //count number of even and odd integers
               //return as a list of two elements
L{~j.Q:?%2=~i.Q} //split even and odd integers into two separate lists
L{(max &~x ?)} //return the maximum element of a list
L{?%2=Q%} //return the first odd element in a list or No
L{?%2=~_=Q} //return the last odd element in a list or No
L{?%2=~~%} //return index of the first odd element in a list or No
L{?%2=~_=~~} //return index of the last odd element in a list or No
[a b c d e]{?,5+} //((a 5) (b 6) (c 7) (d 8) (e 9))
10{&1*2:} //(2 4 8 16 32 64 128 256 512 1024)
Xs{A,B = ~i.A ~j.B} //matrix transpose. Same as Xs.zip

Now, given a list `L: [1 1 1] [2 3 4] [5 6]`

say L{_ ~ _}  //says (1 3 (5 6))
say L{:_ ~ _}  //says (1 3)
say L{_ ~ _;~ _} //says (1 3 5)
say L{_ ~ ~} //((1 1) (3 4) (5 6))

Hope Symta got you interested. Want more examples?

For every character in text T, count number of occurencies, and output sorted by frequency

D!;S{&D.?+1};D.s|?1>??1

`D!` - declares a hash table D.
`S{@Body}` - apply @Body to every character of S
`D.?` - looks up character in a dictionary
`?` - unbound variable, turns entire formula into a lambda function
`&X+1`- add 1 to X and store back into X
`D.s` - sort dictionary. `.s` is a method call
`?1>??1` - sorting order for `.s`. `??` second argument for the lambda

Well, the above code is kinda verbose, so Symta allows for a shorthand

S{~D.?+}.s|?1>??1

`~D` - implcitly declared and returned hashtable
`+` - post increment operator, similar to `++` in C-based languages

If there are several ~Name variables, then they are returned as a list.

Here is more word processing. We all know the classic magic numbers, like 0xcafebabe and 0xA55ba11. But are there more? Given an English words dictionary `Ws`, find all the words representable in hex that way:

Ws{?{b=8;l=1;s=5;t=7}}.keep ?all^|'8157abcdef'.any ?

Compute huffman codes for a string

S "osteoclasts undergo apoptosis at the end of the bone resorption phase"
H heap; S{~D.?+}{|H.push@?f}  //count frequencies and add them to heap
(H.n-1){2{H.pop:}(A,B C,D=H.push A+C B,D):} //build tree
C [[]H.pop.1](:D,[L R] = @[0,@D L]^r @[1,@D R]^r; D,C=:C,D) //unroll tree
say C.s(?1.n<??1.n) //output sorted by code length
30 2024-03-10 10:18

k

31 2024-03-10 16:36 *

idk this bloated syntax gave me new jersey aids

32 2024-03-10 19:34 *

Symta looks as terrible as Perl.

33 2024-03-10 23:12

>>31

syntax is bad! bad! god punish! punish!

34 2024-03-11 09:51 *

>>33 (((mason)))
Yes.
Lithp II further removes syntax
The great unknown god wills these worthless complexity masturbatory contests out of existence

35 2024-03-14 00:45 *

sadkov when happykov walks in:

36 2024-03-14 02:24

GOAL

37 2024-03-14 05:07

my favorite lisp is javascript :D

38 2024-03-14 13:16

LISP (John McCarthy Edition™)
https://www-formal.stanford.edu/jmc/recursive.pdf

39 2024-03-15 13:00

GOOL/GOAL.
https://all-things-andy-gavin.com/tag/lisp/

40 2024-04-05 23:59

>>36,39
Absolutely heartbreaking what Sony did there.

41 2024-04-06 08:02

>>40
That Lisp dialect was too difficult for most programmers to comprehend. It's sensible for Naughty Dog to create their new games with the industry standard of C and C++.

42 2024-04-08 00:00

I haven't written anything other than Common Lisp in a long time

43 2024-04-09 12:58

Comfy Clojure, but I bounce between it and Common Lisp.

44 2024-04-09 14:00

>>43
Can we get a link to this Comfy Clojure. Like >>39 provides for GOAL.

45 2024-04-10 06:19

>>44
Probably just referring to normal Clojure and calling it comfy.

46 2024-04-10 08:14 *

Though I've spent a lot of time before getting familiar with Common Lisp, I'm doing most of my hacking in Emacs Lisp these days.
I honestly prefer the way Elisp and feels does things in some ways over CL, and my ideal Lisp would be somewhere between the two (maybe I'm just talking Lisp Machine Lisp without even knowing it!). Having said that, they're already very close, and the cl-lib extensions give it an enormous amount of power with its macros and CLOS implementation.

47 2024-04-10 08:41

>>46
Try https://interlisp.org

48 2024-08-26 09:58

Obscure Lisps: EuLISP (https://github.com/Henry/EuLisp) and ISLisp (for example, https://github.com/sasagawa888/eisl)

Then there is PicoLisp, lfe (Lisp Flavoured Erlang), lux (https://github.com/LuxLang/lux), Coalton, Janet and newLisp if you want something that's actually maintained.

I also heard about Flesh: https://gitlab.com/whom/relish Flesh/relish is a Lisp that can be used as login shell, it's a bit similar to scsh or that one guy who used Clisp as his login shell ("CLASH" or CLisp As SHell.)

More can be found at https://github.com/dundalek/awesome-lisp-languages

Just stumbled upon Chialisp: https://chialisp.com

49 2024-08-27 20:10

perl :^)

50 2024-08-31 23:33

Common Lisp :-)

51 2024-09-04 23:52

Clojure

52 2024-09-06 19:06

Guile

53 2024-09-07 21:13

Golang

54 2024-09-07 23:21

cum

55 2024-09-17 18:50

emacs-lisp

56 2024-09-22 02:57

List Processor!

57 2024-09-24 05:07

Probably Common Lisp or Elisp. While of course this board is prove for the opposite, I don't feel like you can do much with Scheme these days than just very academic things, meanwhile CL seems more practical and more useful to program real things in. Elisp seems like a middle ground, but I don't use Emacs anymore, so I don't use it.

58 2024-09-27 02:18 *

>>57
Why don't you use Emacs anymore?

59 2024-09-28 21:57

Racket! I love racketeering! $\( ̄▽ ̄)/₿

60 2024-09-30 17:08

>>58
I grew tired of tinkering with it and I didn't see many upsides compared to using standard and de-facto standard Unix utilities. It's not like I don't have time tinkering with Emacs, it's just that I didn't like it anymore. However, I'm still having Emacs in the back of my mind and considering it, for basically having a reproducible configuration (similar to the Nix-OS), where you just write one init.el and it works everywhere (hopefully that comparison isn't too much of stretch). Also, having that such a program fully customized to my needs is also an appeal, but I'm focus on other things right now, that are not Emacs, which doesn't mean I left it forever.

61 2024-10-07 21:40 *

>>60

I grew tired of tinkering with it and I didn't see many upsides compared to using standard and de-facto standard Unix utilities.

So what now, ed(1)?
I found with time that many Unix utilities are very painful and unintuitive to use regularly. The Unix command line is a hell that Emacs can't save you from entirely, but it has many features that can lessen the pain like Dired, Info, rgrep, vc/magit, eshell and so on. In any case, I just don't see a reason to want to abandon all of Emacs, since it's still the finest editor you can have on any system.

62


VIP:

do not edit these