Lisp

53 readers
3 users here now

founded 1 year ago
MODERATORS
76
 
 

Hi y'all,

I'm experimenting with Readline config (generating completions, setting up keybindings, etc.) for CL REPLs. It's working, with a single exception: completions are split over hyphens, e.g. typing mak, I get make and makunboud as the only completions. Even though there're make-array and make-instance in the completions file. Anyone knows how to allow completing mak to make-array, make-instance and other hyphenated words? Any other gotchas for Lisp-specific Readline setup?

77
 
 

Mi first blog post, about some techniques on debugging/exploring/understanding Clojure codebases in an interactive way using FlowStorm and the repl.

https://jpmonettas.github.io/my-blog/public/compilers-with-flow-storm.html

It also contains a tour over the internals of the ClojureScript compiler, as it is used as an example of a non trivial Clojure project.

No previous knowledge in compilers is needed and is made so you can follow along by pasting commands on your terminal.

78
79
80
81
 
 

sbcl-lisp : 0.7s

racket-scheme : 0.7s

ccl-lisp : 6s

kawa-scheme : 14s

abcl-lisp : 45s

82
 
 

The idea that one can change and modify code while it is running sounds great, but I have never really gotten to the point that I understand practically how to do it in a non-trivial circumstance. As a concrete example where I think I should be able to do it, but I can't, is when running one of the examples from the claylib system. I am using slime/emacs and I open claylib/examples/shapes/bouncing-ball.lisp. In slime I use (in-package :claylib/examples/bouncing-ball) and then (main) and I have the bouncing ball demo working fine. What I have tried to do is to change the color of ball from its current +maroon+ to some other color. I have tried editing that part of the function definition in bouncing-ball.lisp and recompiling, but nothing changes. If I kill the running example, recompile the bouncing-ball.lisp and then re-run main I see the new color, so I know that I am specifying a color correctly. Would someone tell me the steps to change the ball color while it is bouncing around to help me get started on this "live" coding method? Of if they think one of the other raylib wrappers would be better for this I can change. I am just using this as a learning tool to give me some visual feedback as I make changes. Thanks.

83
 
 

The lisp program to compile :

library.lisp

(load "~/quicklisp/setup.lisp")
(declaim (optimize (speed 3) (safety 3) (space 0) (debug 3)))
(ql:quickload "defstar")

(defpackage package-library
    (:use #:cl #:defstar)
    (:export printstring))

(in-package :package-library)
(defun* (printstring -> boolean) ((s string))
    (princ s) t)

The lisp program performing the compilation :

compîle.lisp

(declaim (optimize (speed 3) (safety 3) (space 0) (debug 3)))
(load "~/quicklisp/setup.lisp")

(format t "~a~%" "COMPILING library.lisp")
(CL:COMPILE-FILE "library.lisp")

(format t "~a~%" "Done compiling")
(quit)

The script to perform the compilation :

rm *.abcl
echo "COMPILING"
time abcl --noinform --noinit --nosystem --load compile.lisp

The error/bug :


COMPILING library.lisp
; Compiling /mnt/xxx_data/Languages_ok/lisp/abcl/module/library.lisp ...
; (LOAD "~/quicklisp/setup.lisp")
; (DECLAIM (OPTIMIZE # ...))
; (QUICKLISP-CLIENT:QUICKLOAD "defstar")
; (DEFPACKAGE PACKAGE-LIBRARY ...)
Error loading /mnt/xxx_data/Languages_ok/lisp/abcl/module/compile.lisp at line 6 (offset 171)
#: Debugger invoked on condition of type ERROR
  DEFSTAR is not the name of a package.

84
 
 

Today, I finally invested the time to fix an issue forever, hopefully 😄

We need Maven3 to install a few jars into the local Maven repo. Regrettably, older versions of Maven3 are regularly deleted from the download server (https://dlcdn.apache.org/maven/maven-3/). This broke our Docker image build process over and over again.

To fix this misery, I wrote a small Babashka script that finds out the latest version of Maven3 on its own:

https://github.com/simplemono/a-la-carte/blob/main/maven3/install

It replaces the old script that suffered from the described problem. The a-la-carte project contains this new script to conveniently install Maven3 into your Docker image if it is based on Ubuntu.

https://github.com/simplemono/a-la-carte/blob/main/install.md#maven3

85
 
 

https://preview.redd.it/4m7l9lz3ybvb1.jpg?width=1920&format=pjpg&auto=webp&s=795b207a3b246f750c296e2ba27aa16a6bbb38df

THIS IS AN ONLINE EVENT
[Connection details will be shared 1h before the start time]

The London Clojurians are happy to present:

Roman Liutikov (https://twitter.com/roman01la) will be presenting: "UIx, a story behind yet another React wrapper"

In this talk, we'll go over a brief history of React wrappers in ClojureScript. I'll bring you up to date with modern React, and you'll learn about UIx, the motivation behind it, how the library came to be, and how it found its second home at Pitch.

Roman has been using Clojure at work since 2015 and has dedicated most of his career to front-end engineering. Outside of his daily job, he explores graphics programming, Blender, and AI.

If you missed this event, you can watch the recording on our YouTube channel: https://www.youtube.com/@LondonClojurians (The recording will be uploaded a couple of days after the event.)

Please, consider supporting the London Clojurians with a small donation:

https://opencollective.com/london-clojurians/

Your contributions will enable the sustainability of the London Clojurians community and support our varied set of online and in-person events:

  • ClojureBridge London: supports under-represented groups discover Clojure
  • re:Clojure: our free to attend annual community conference
  • monthly meetup events with speakers from all over the world
  • subscription and admin costs such as domain name & Zoom plan for larger online meetups

Thank you to our sponsors:

RSVP: https://www.meetup.com/London-Clojurians/events/296853289/

86
87
 
 

To begin with, I'm a very happy Clojurian, but not when I'm working with interops. I'm using Google apis extensively for some features in my product; and so far the experience has been quite awful. I've been contemplating it for a while and here are my pain points.

  1. It is hard to look up for what method a java object supports.
  2. It is hard to understand the inheritance and polymorphism designs without actually looking at the java codes.
  3. 1,2 are amplified all the more because I'm using calva with vscode. The IDE's java support is not as good as that of intellij.

How do you work with interops in general? I welcome any tips/advices/know-hows.

88
 
 

How to write a "hello world" ltk application using ccl lisp ?

89
 
 

The following is a kawa scheme program consisting of 3 files

Mytest.scm


(module-name MyTest)
(module-compile-options main: #t)
(define (printc)
    (display "c"))
(require 'srfi-1) ;;  List Library
(define (main)
    (import MyTestA)
    (printa)
    (MyTestB:printb)
    (printc))
(main)

MyTestA.scm


(module-name MyTestA)
(module-export printa)
(define (printa)
    (display "A"))

MyTestB.scm


(module-name MyTestB)
(module-export printb)
(define (printb)
    (display "B"))

To compile & run,

rm -vf ./*.class
kawa -Dkawa.import.path="." -C ./MyTestA.scm
kawa -Dkawa.import.path="." -C ./MyTestB.scm
kawa -Dkawa.import.path="." --main -C ./MyTest.scm
kawa MyTest

How do i do the same thing in abcl lisp ?

90
 
 

About two weeks ago, I posted a vacancy in the monthly "Who's hiring" thread for our legal drafting SaaS company.

To be honest, I really didn't know what to expect. There were a few anecdotal stories that talked about a "hiring filter", i.e. that the amount of available Clojure-developers was small, but that the quality of those developers tends to be very high when compared to other languages. I also assumed that our 100% Clojure(Script) stack and our completely remote working policy would help. At the same time, I realise that we are a small company in the legal sector, which many developers probably (incorrectly!) do not associate with cool work.

So I was hoping for a few interesting reactions, but the amount of reactions that I actually got, was far, far better than what I had expected.

  • In total we got 27 reactions, in a matter of a few days, from all over the world.
  • None — literally none — of the reactions were a mismatch. Of course some developers were a better match for us than others, but based on the CVs, I could have hired every single developer that applied. We honestly had a hard time choosing.
  • For about 60% of the reactions, the accompanying email or cover letter went into specific detail as to why the developer in question would be a good match.
  • Only one woman replied.

Our company exclusively consists of lawyers (we all worked at these large law firms in our previous life), so we can only compare these results to a recent hiring process for a lawyer, where we applied equally flexible hiring criteria (remote, anywhere from the world, having credentials or experience in a relevat legal subject matter), and got the following results:

  • About 15 reactions.
  • 12 out of 15 had no, or only limited, relevant experience.
  • Limited cover letters.
  • A nice mix of gender.

And please take into account that, unlike what I guess many developers think, "legal tech" is seen as very hot among lawyers nowadays.

So if any company, or investor, is doubting Clojure based on the talent pool, I can assure you: a non-issue.

91
 
 

Are you ready for RacketCon?

We are!

Support you favourite Programmable Programming Language conference and get your tickets at https://www.eventbrite.com/e/racketcon-2023-tickets-669052563227 (live stream only $10)

View Poll

92
 
 

I have the following code (reduced to a minimum working example):

(ns timer.core (:gen-class))

(defn handle2 [x]
  (if (string? x) (Integer/parseInt x) x))

(defn -main
  ([max-time]
   (println (format "Going to sleep %d seconds" (handle2 max-time)))  
   (let [sleep-time (* (handle2 max-time) 1000)]  
     (Thread/sleep sleep-time)  
     (println (format "Waken up"))))  
  ([] (-main 10)))  

that works in the cider REPl on emacs and also works with > lein run on a windows terminal (x64 Native Command Prompt for VS 2022) and also can be compiled into an uberjar with leiningen and calling the java -jar command works. All the previous work with or without the max-time argument, as it is expected.

But when I build a executable from the uberjar with the GraalVM using the command

>  native-image --report-unsupported-elements-at-runtime --initialize-at-build-time -jar .\target\timer-0.1.0-SNAPSHOT-standalone.jar -H:Name=timer-cli

although it compiles a timer-cli.exe executable binary, this fails when is run with this error:

exp-timer-cli.exe
Going to sleep 10 seconds
Exception in thread "main" java.lang.IllegalArgumentException: No matching method sleep found taking 1 args
        at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:127)
        at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:332)
        at timer.core$_main.invokeStatic(core.clj:72)
        at timer.core$_main.invoke(core.clj:68)
        at timer.core$_main.invokeStatic(core.clj:76)
        at timer.core$_main.invoke(core.clj:68)
        at clojure.lang.AFn.applyToHelper(AFn.java:152)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at timer.core.main(Unknown Source)

with or without parameter. But if I substitute (handle2 max-time) by an actual number (let's say 2), the program works, but of course with the hardcoded variable as sleep time, and prints the parameter value on the message string.

Does any one have experience with the GraalVM and knows why this happens? And how to solve this would be greatly appreciated.

Using:

  • Leiningen 2.10.0 on Java 19.0.2 OpenJDK 64-Bit Server VM
  • GraalVM 22.3.1
93
 
 

https://preview.redd.it/fvlx720gc5vb1.jpg?width=1920&format=pjpg&auto=webp&s=cbf9180e42e571510aef4b9be6d7a2b6358abdf7

THIS IS AN ONLINE EVENT
[Connection details will be shared 1h before the start time]

The London Clojurians are happy to present:

Title: A functional approach to massively concurrent application design
Speaker: Léo Noel Time: 2023-10-31 @ 18:30 (London time)
Local time: click here for local time
RSVP: https://www.meetup.com/London-Clojurians/events/295524353/

Léo Noel (https://github.com/leonoel) will be presenting: "A functional approach to massively concurrent application design"

In this talk, Léo will present the latest features of Missionary, a functional effect system for clojure/script. He will focus on the supervision problem, explain what it is about, show how pervasive it is in our craft, and describe a functional solution scalable to arbitrarily complex problems in many domains, from UIs to databases.

You will learn how functional effect systems fit in the reactive programming landscape and how they address common concurrency concerns such as memoization, asynchronous effects, backpressured streaming, glitch-free propagation of changes and fine-grained updates.

Léo is the creator of Missionary and the architect of Electric Clojure. As an independent software researcher, he is interested in concurrency, reactive user interfaces and language design.

If you missed this event, you can watch the recording on our YouTube channel: https://www.youtube.com/@LondonClojurians (The recording will be uploaded a couple of days after the event.)

Please, consider supporting the London Clojurians with a small donation:

https://opencollective.com/london-clojurians/

Your contributions will enable the sustainability of the London Clojurians community and support our varied set of online and in-person events:

  • ClojureBridge London: supports under-represented groups discover Clojure
  • re:Clojure: our free to attend annual community conference
  • monthly meetup events with speakers from all over the world
  • subscription and admin costs such as domain name & Zoom plan for larger online meetups

Thank you to our sponsors:

RSVP: https://www.meetup.com/London-Clojurians/events/295524353/

94
95
96
 
 

Hello, after many years only developing cute websites in my free time, occupied in other physical business, I decided to move to switzerland or us from Italy, that is nearly economically and politically and socially dead.

I am a very experienced web developer because that is what I have been doing for almost 10 years before changing business area. Now I am back, my knowledge on Grails seems very useless for finding a society to hire me, so I am trying to decide which language to specialise in between

Thank you for any of your kind opinions and experiences, in case you are willing to share.

#clojure #rust #golang #rubyonrails #grails #webdevelopment #seo

View Poll

97
98
99
 
 

Personaly i found abcl a bad experience.
Thoughts on ecl & clisp ?

sbcl works nice & fine. But i't's the only lisp implementation i know.
There are good books on racket-scheme & chez-cheme.
The only book i know for lisp is, "Common lisp , a gentle introduction to symbolic computing".

100
view more: ‹ prev next ›