God writes in Lisp

[ I know typed-racket and it was worth the effort learning ]
I came across following names : although i don't know what they are good for ,or bad for. Nor how to use them.
-carp
-qi
-coalton
-blisp
-typer
-shen

I wonder, could i write a gui or database-query in "shen" language. Anyone ?

I'm not much into languages that are very obscure and have very small userbases.

I strongly warn against using such languages except for learning new concepts, but there are probably enough more popular languages to stretch your mind.
 
I'm having trouble with the title of this thread.
My understanding of "God" is that everything would spring fully formed from his thoughts, so why would he write in anything?
 
I think this metaphysical question was asked as a "wink".
Note : following program runs fine without any changes on freebsd & debian.

Code:
(load "~/quicklisp/setup.lisp")
;(compile-file "./ltk/ltk")
;(load "./ltk/ltk")
(ql:quickload "ltk")
(in-package :ltk)

(declaim (optimize (speed 3) (safety 3)))

(defun main()
  (with-ltk ()
   (let ((b (make-instance 'button
                           :master nil
                           :text "Press Me"
                           :command (lambda ()
                                      (format t "Hello World!~&")))))
     (pack b))))

(sb-ext:save-lisp-and-die "myltk.exe" :toplevel #'main :executable t)

Note : you just need one softlink :
./wish8.5 -> /usr/local/bin/wish8.6
 
For the one who is interested.

Type checking in sbcl using "serapeum" :
Code:
(-> addtwo ( integer ) integer )
(defun addtwo (x)
  ( +  2  x ))

Type checking in sbcl using "defstar":
Code:
(defun* ( addtwo -> integer ) ((x integer))
  ( +  2  x ))
 
cracauer@ I finally had a chance to read your articles. Another language that has the ability to call any method during compiling is forth. That thing goes a bit further, as the compiler core itself has only 6 lines of code. Even if/then/else can be done in forth itself. That raises the hen/egg question, but I thought I should mentioned it for completeness' sake.
 
rust, C, lua, and go.

I've only used LISP to work through SICP. I have taken a solemn vow to never touch it again. The professor was an absolute nightmare.

Vale is a language I'm actively monitoring. https://vale.dev/
 
Below an example of a postgresql database query :

Code:
(load "~/quicklisp/setup.lisp")
(declaim (optimize (speed 3) (safety 3)))
(ql:quickload :postmodern)
(use-package :postmodern)

(defun myquery ()
  (let ( (datetime)  (program)  (pid) (message)
        (fdatetime)  (fprogram) (fpid) (fmessage)
        (sum));let
    (doquery (:order-by (:select 'datetime 'program 'pid 'message :from 'messages_gentoo_20230926) (:desc 'datetime))
                     ( datetime  program  pid  message)
             (setf fdatetime (format nil "~12A" datetime  ))
             (setf  fprogram (format nil "~10A" program   ))
             (setf      fpid (format nil  "~5A" pid       ))
             (setf  fmessage (subseq (format nil "~60A" message   ) 0 40 ))
             (setf       sum (concatenate 'string fdatetime "|" fprogram "|" fpid "|" fmessage ))
             (print sum)
             )));defun

(defun main ()
  (connect-toplevel "syslogng" "x" "secret" "127.0.0.1" :port 5432 )
  (myquery));main

(sb-ext:save-lisp-and-die "h.exe" :toplevel #'main :executable t)
 
example of the statically typed , "specialized" language coalton,

Code:
(load "~/quicklisp/setup.lisp")
(declaim (optimize (speed 3) (safety 3)))
(ql:quickload "fiasco")
(ql:quickload "coalton")
(defpackage pack
  (:use #:coalton #:coalton-prelude)
  (:export main) ) ;defpackage
( in-package :pack)
(named-readtables:in-readtable coalton:coalton)

(coalton-toplevel
    (define-type IntList
        (MyCons Integer IntList) MyNil) ;define

    (declare L IntList)
    (define L (MyCons 1 (MyCons 2 (MyCons 3 MyNil)))) ;define

    (declare sumlist ( IntList  -> Integer))
    (define (sumlist x)
        (match x
            ((MyCons y z) (+ y (sumlist z)))
            ((MyNil)      0   ))) ;define

    (declare printInt ( Integer -> Unit ))
    (define (printInt s)
        (lisp Unit (s)
            (cl:princ s)
            Unit)
        ) ;define

    (declare main ( Unit -> Unit))
    (define (main) (printInt (sumlist L))) ;define
    ) ;toplevel

(in-package :cl)
(defun main ()
    (pack:main coalton:Unit ) ) ;defun
(sb-ext:save-lisp-and-die "test.exe" :toplevel #'main :executable t)
 
My usual way to understand a language is to write small test routines and look at the generated machine code. In case of LISP, this seems futile.
ccammack We tried to use prolog as a proof system for software some centuries ago (so it feels), where you would write "shit happens if..." statements into comments and then a pass would extract them and try to solve it. We failed due to scoping and because it became hard to handle. These days, clang-analyse does that trick.
 
I'm not much into languages that are very obscure and have very small userbases.

I strongly warn against using such languages except for learning new concepts, but there are probably enough more popular languages to stretch your mind.
Language features are mostly ok. Problem is the available libraries out-of-the-box.
Without libraries-functions you are forced or , into a narrow eco-system, or have to write tedious wrappers.
 
My usual way to understand a language is to write small test routines and look at the generated machine code. In case of LISP, this seems futile.

Code:
(declaim (optimize (speed 3) (safety 0) (debug 0)))

(defun meh (p1 p2)
  (declare (fixnum p1 p2))
  (the fixnum (+ p1 p2)))

Code:
Yes, Master? CL-USER> (disassemble 'meh)
; disassembly for MEH                                                                                                                                                                                                                                                                                  
; Size: 35 bytes. Origin: #x52C8B0FC                          ; MEH                                                                                                                                                                                                                                    
; 0FC:       498B4510         MOV RAX, [R13+16]               ; thread.binding-stack-pointer                                                                                                                                                                                                           
; 100:       488945F8         MOV [RBP-8], RAX                                                                                                                                                                                                                                                         
; 104:       488D043B         LEA RAX, [RBX+RDI]                                                                                                                                                                                                                                                       
; 108:       488BD0           MOV RDX, RAX                                                                                                                                                                                                                                                             
; 10B:       48D1E2           SHL RDX, 1                                                                                                                                                                                                                                                               
; 10E:       700A             JO L0                                                                                                                                                                                                                                                                    
; 110:       488D1400         LEA RDX, [RAX+RAX]                                                                                                                                                                                                                                                       
; 114:       488BE5           MOV RSP, RBP                                                                                                                                                                                                                                                             
; 117:       F8               CLC                                                                                                                                                                                                                                                                      
; 118:       5D               POP RBP                                                                                                                                                                                                                                                                  
; 119:       C3               RET                                                                                                                                                                                                                                                                      
; 11A: L0:   CC4D             INT3 77                         ; OBJECT-NOT-FIXNUM-ERROR                                                                                                                                                                                                                
; 11C:       02               BYTE #X02                       ; RAX                                                                                                                                                                                                                                    
; 11D:       CC10             INT3 16                         ; Invalid argument count trap                                                                                                                                                                                                            
NIL
 
The first time I learned about regular expressions was when I tried to implement them in a search for an 8bit editor.
I was using z80 assembler, but I couldn't write directly.
So I left the machine and wrote them in lisp on paper, debugged them, and then returned to the machine and rewrote it in assembler.
Only that part of the assembler code made extensive use of recursion.
 
Below an example of a postgresql database query :

Code:
(load "~/quicklisp/setup.lisp")
(declaim (optimize (speed 3) (safety 3)))
(ql:quickload :postmodern)
(use-package :postmodern)

(defun myquery ()
  (let ( (datetime)  (program)  (pid) (message)
        (fdatetime)  (fprogram) (fpid) (fmessage)
        (sum));let
    (doquery (:order-by (:select 'datetime 'program 'pid 'message :from 'messages_gentoo_20230926) (:desc 'datetime))
                     ( datetime  program  pid  message)
             (setf fdatetime (format nil "~12A" datetime  ))
             (setf  fprogram (format nil "~10A" program   ))
             (setf      fpid (format nil  "~5A" pid       ))
             (setf  fmessage (subseq (format nil "~60A" message   ) 0 40 ))
             (setf       sum (concatenate 'string fdatetime "|" fprogram "|" fpid "|" fmessage ))
             (print sum)
             )));defun

(defun main ()
  (connect-toplevel "syslogng" "x" "secret" "127.0.0.1" :port 5432 )
  (myquery));main

(sb-ext:save-lisp-and-die "h.exe" :toplevel #'main :executable t)

Below an example of a postgresql database query :

Code:
(load "~/quicklisp/setup.lisp")
(declaim (optimize (speed 3) (safety 3)))
(ql:quickload :postmodern)
(use-package :postmodern)

(defun myquery ()
  (let ( (datetime)  (program)  (pid) (message)
        (fdatetime)  (fprogram) (fpid) (fmessage)
        (sum));let
    (doquery (:order-by (:select 'datetime 'program 'pid 'message :from 'messages_gentoo_20230926) (:desc 'datetime))
                     ( datetime  program  pid  message)
             (setf fdatetime (format nil "~12A" datetime  ))
             (setf  fprogram (format nil "~10A" program   ))
             (setf      fpid (format nil  "~5A" pid       ))
             (setf  fmessage (subseq (format nil "~60A" message   ) 0 40 ))
             (setf       sum (concatenate 'string fdatetime "|" fprogram "|" fpid "|" fmessage ))
             (print sum)
             )));defun

(defun main ()
  (connect-toplevel "syslogng" "x" "secret" "127.0.0.1" :port 5432 )
  (myquery));main

(sb-ext:save-lisp-and-die "h.exe" :toplevel #'main :executable t)
if you paied per line this is for sure a deal ;)
i loved CL in the past, but really, to do this you must be payed by line of code;)
Perl and Ruby are much better (faster to write and maybe a lot more readable) doing this.
For sysadmin tasks i use Ruby and i love it. It was born for Unix.
Ok, you have the binary, it might serve some purpose.
 
"ANSI Common Lisp" and "On Lisp" are both by the same author. "On Lisp" (mostly about metaprogramming) is free (no cost) now. Not sure about ANSI Common Lisp.
 
Back
Top