GithubHelp home page GithubHelp logo

repl not repling about alive HOT 118 CLOSED

nobody-famous avatar nobody-famous commented on July 19, 2024
repl not repling

from alive.

Comments (118)

cooleynal avatar cooleynal commented on July 19, 2024

to add when I open the REPL window I have this

"
CL-USER>
CL-USER>
CL-USER>
CL-USER>
"

Thanks.

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

So if you do something like (+ 2 2) in code, and then eval it with ctrl+enter or whatever you have it set to, what does it do?

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Thanks for the fast reply.

Please hang tight restarting the program to see if it makes changes.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

no change :/
just acts as a new line and the CL-USER> prompt isnt repeated.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

The repl window is implemented as a text document so that you can edit stuff normally in it. To get it to eval something, you need to run the Send To Repl command, which defaults to alt+shift+enter if you haven't changed it.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

i love you. Seriously! got back

(require 'asdf)

=> nil
CL-USER>

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

now to spam you some more if you dont mind, now i need to get asdf working?
according to the gif i should get back ("uiop "UIOP "asdf" "ASDF")

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Ok, that should have loaded the library. Then you need to load your .asd file. If you have it open, doing Alt+Shift+L inside it should load it. Then in the repl (asdf:load-system "whatever you named it") should work.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

I am still here, I am very new in this environment. Will take me a minute to understand what that means then to execute.

I ask for your patience. Thanks.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Oh, right. I need to update that gif. It doesn't print that message anymore. Weird, technical reasons. :-)

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

ah i dont feel so dorky.

So. I don't think I ever manually loaded an asd f file. In my earlier attempts to get this working, I installed quicklisp but its not used, however I found a huge asdf.lisp file in it.

I do remember when I installed SBCL and ran through the prompts and I saw something saying asdf but I did not know what it was.

So can i move that asdf file to where the server is located ?

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

No worries, it takes some getting used to.

The require command loads the ASDF library, which lets you run the various commands.

The main one is asdf:load-system, which will load a system you defined with a defsystem statement. It's usually put in a file with the same name as the system you define. So, foo.asd will have a (defsystem "foo" ...) inside it.

You need to evaluate all the stuff inside that file so that ASDF can load it. The easiest way to do that is to do the Load File command, Alt+Shift+L.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

SBCL includes ASDF so you don't have to install it separately, which is what the asdf.lisp file is.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

huh okay, I dont see it where I have installed it in sbcl, which is one folder outside of where my visual studio code project is

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Alt shift L on the repl doesnt do anything, but on my little program causes a crash

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Hmm... maybe that version is from something else. In my SBCL install it has asdf.fasl, which is a compiled version.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

sorry. you are correct. first file in the contrib folder

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Oh, right. alt shift L in the asdf file editor. doing it in the repl will try to load the repl contents, which probably won't end well. Actually, that shouldn't be enabled. I'll have to fix that.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

afds.fasl

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

The fact you know this stuff is amazing,

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Wait, I think I misunderstood you. What crashed?

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

It's amazing how much you learn writing an extension like this. :-) I didn't know this stuff nearly as well until I had to try to handle all the edge cases that can come up.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Alt shift L when i have the program called tt1.lisp highlighted crashes.

When I have repl window highlighted (asdf:load-system: tt1) followed by Alt Shift Enter crashes

That being said I have an error in my code. I am throwing something else on it now and trying.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

I am documenting a notepad cheatsheet as were going through this, so thats where my delays might stem from to.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

When you say it crashed, does the debugger come up? Or the REPL gets hosed?

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

debugger in both cases. sorry. Overall this is very well behaved.

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

I don't know if it will help you or not, but I started using a tool called clpm that works like package tools in other languages. If you install it, it can be configured to interact with asdf in a way that lets the debugger intercept the errors caused by libraries missing, and automatically install them for you via the debugger. It won't get you around having to learn asdf, but it will let you tinker a little more easily. I have a gif here if you want to see what I mean.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Ok, cool. Just a heads up, SBCL on windows is flaky. Their info banner mentions it. The main weirdness I've found with it is doing command completion with anything starting with p causes the debugger to come up. I have no idea why that happens. It also takes swank several minutes to exit.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

okay thanks. Ill wrestle this a bit more.

I noticed that in the docs on sbcl as well, was hoping to have a modern compiler.

How do i change my compiling hotkeys? i didnt see it in the options

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

I need to look into clpm. It sounds like there's some good stuff going on there.

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

Also, @cooleynal, if you are on windows, you may find it easier to do all of this in wsl. Code can hook to it from windows and it works great. Worst case, you can do your dev and repling in wsl, and then if you need to build a windows binary, suffer through it then.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

To change the hotkeys, go to File->Preferences->Keyboard Shortcuts and you can set them to whatever in there. It'll also let you know what they conflict with. I prefixed all the commands with Alive, so you should be able to search for that.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

thanks. Ill look at that in a bit.

So I fixed the program called tt1.lisp, its a simple : (write-line "Hello World").

I saved it.

(require 'asdf) alt shift enter. and i get back ...

(require 'asdf)

=> NIL
CL-USER>

So where do I go from here?

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

OH shoot, i just noticed that is demo.asd and math.lisp.

I dont know what an .asd is.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

taking your work, would

(in-package :asdf-user)
(defsystem "exp"
:components ((: file "package")
(:file "tt1")))

work as an asd file?

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Yeah, it looks like that should work. After you load that file, do (asdf:load-system "exp") in the reply and it should load it.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

hmm nothing on alt shift L, and alt shift enter gives errors

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Error while trying to load definition for system exp from pathname C:/Users/tr/Desktop/LISP VSC/COMP-456/exp.asd: READ error during LOAD: illegal terminating character after a colon: #\ Line: 3, Column: 19, File-Position: 61 Stream: #
[Condition of type ASDF/FIND-SYSTEM:LOAD-SYSTEM-DEFINITION-ERROR

im gonna hit the sack, ill be on tomorrow. thanks for far!

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Hmmm... doing Alt+Shift+L from your exp.asd file should have a couple comments show up in the repl saying it's loading the file.

The error is because you have a space after one of the colons, ": file" instead of ":file". A colon starts a symbol, so a colon by itself is illegal.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

;; Loading c:\Users\tr\Desktop\LISP VSC\COMP-456\exp.asd

;; Done loading c:\Users\tr\Desktop\LISP VSC\COMP-456\exp.asd
CL-USER>

boom! good eye

Still messing around with it.

I have clisp running on eclipse with danelion, ive just like the interface of VS code more and hope to have this figured out enough where i can use it for my course.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024
when selecting exp.asd i put alt+shift+l

;; Loading c:\Users\tr\Desktop\LISP VSC\COMP-456\exp.asd

;; Done loading c:\Users\tr\Desktop\LISP VSC\COMP-456\exp.asd

CL-USER> (require 'asdf) and alt shift enter

(require 'asdf)

=> NIL

(asdf:load-system: tt1) and alt+shift+enter

throws an error. too many colons in "load-system" Line: 1, Column: 17, File-Position: 17 Stream: #
[Condition of type SB-INT:SIMPLE-READER-ERROR]

i cant win haha

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

I think i bit off more than i can chew in trying your product, I hardly know the language. Thanks for your support but this is a lot to wrestle this early in my experience. I will defiantly be checking back regularly.

Its a shame that lisp is this hard to get started (unless you use portacle) its such a cool language and integrating compability with cool IDEs would defiantly help get it some more clout.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

It's the colon problem again. Symbols are like constant strings. Sort of. So, :tt1 is roughly equivalent to "tt1". Either one should work here. (asdf:load-system :tt1) and (asdf:load-system "tt1") should be equivalent. They're interchangeable whenever a macro takes a "string designator". Load-system is one, in-package is another. (in-package :cl-user) and (in-package "cl-user") are equivalent.

Because you had the colon at the end of load-system, it complained that there was already a colon in that token. A symbol can be prefixed with the package it's in, which is what asdf:load-package is doing. load-package is a symbol in the asdf package.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

I definitely feel your pain. Wait til you try to wrestle with the loop macro. :-)

It's a different language that hasn't been updated since the 90s, so it doesn't follow the norms of other current languages. For example, it doesn't throw and catch exceptions. It signals and handles conditions. Really the same thing, but it was created before try/catch was popular so doesn't use that terminology.

Stick with it. There's some interesting things with it that are worth learning about.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024
I cant win haha. 

(asdf:load-system :tt1) + alt shift L

Component :TT1 not found
[Condition of type ASDF/FIND-COMPONENT:MISSING-COMPONENT]

Its okay, I give up and I need to direct my study to the language instead of wrestle it.

Yeah its a remarkable language that I have yet to appreciate. for my course I can do prolog or lisp, I am sticking with lisp since its older, I expected some hickups. We got no information on how to run lisp programs, just told two lines :"clisp and quicklisp" and here is a book. Joys of online learning. based on course descriptions, some other universities run this course in java to make things easier on the students.

I am always getting my hotkeys mixed up and glitching up portacle and thats my intent to get into a nice IDE like VScode or eclipse.

Even lisp integrates pooly in eclipse, with clisp and SBCL, and about four different versions with each, only one of them works on my windows PC. I also manually installed SBCL (the one that works here) and getting IO exceptions.

Back to 2010 32 bit on single threads on clisp i guess lol.

I learned a bit here, didnt know we could package, and i guess the asd file is a module to C++, or java is package

Any chance lisp proper programs can run on clojure? if so, I could just rename my files to .lisp and hand them in that way.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Yeah, you might be better skipping asdf for now. The error means your defsystem call didn't take, for some reason.

All asdf is really doing is letting you organize large projects and loads the files for you. You can load the files manually and if you're only using a single file then asdf is overkill, anyway.

The analogy for asdf is
system == application
package == module/namespace

Lisp is different in that the compiler and runtime aren't separate. With other languages you compile text into whatever the runtime takes and then the runtime loads that. With Lisp, the compiler is the runtime. You start the compiler and then give it things to compile.

If you have a file with 2 functions, foo and bar, they don't get compiled together. The first one is compiled and loaded, then the next one. That's why macros can do all their weird things. The compiler has access to everything that's already been compiled.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

AFAIK, there isn't a way to translate Common Lisp into Clojure, or vice versa. If Clojure is an option, it's a little easier to deal with as a language and Calva is a pretty nice environment.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Ah. no option there, 100% lisp and or prolog.

np. i think i got a descent environment going.

I am also reading that we want to be able to code our database, and then query parts of it. if we hit a bug, then we want to evaluate only the top level of the program sometimes. So thats a case where we want more interactivity than notepad++ and basic clisp. Is this the case?

Here i can evaluate vile and evaluate file, evaluate selection, and evaluate selected top level.
Is this basically the functionality of emacs, slime, etc and the requirements of a robust lisp environment?

and github and all the jazz of eclipse.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Yeah, I'm making the same calls that Emacs/Slime uses so it's mostly the same. There's some fringe stuff that I haven't done, but most of the useful parts should be comparable.

The db part is one of the useful things with using the repl. You can read the data into a variable, using defvar or defparameter, and then mess with it all you want without having to hit the db over and over again.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

wrestled it a bit more, looks like its working!

As you said it takes a lot getting use to.

((E E E E) (W E W E) (E E W E) (W W W E) (E W E E) (W W E W) (E W E W)
(W W W W))

Best output text i have ever seen!

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

I don't know if this is helpful, but I created a little tutorial on how to use Alive with SBCL here. It's not done, but it might help people get started. I will keep adding to it.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Very nice. I wont go through it until I have to, however i am saving it under bookmarks as it looks great.

Asking for personal opinions. Is VS Code a good environment to do in lisp? The lisp community sounds very niche relative to the other programming communities and the general consensus is emcs.

I think a lot of it is people are use to operating in the environment they started with.

This is my cheat sheet to fire things up.

==from term==
ros run
(ql:quickload :slynk)
(slynk:create-server :dont-close t)

==from VCS==
ctrl+shift+p
alive

==in repl==
something
Alt+Shift+Enter
//Ctrl

==in file==
Alt+Shift+L

==in selection==
Alt+Shift+Enter

==open second VSC==
==Click drag tab to new VSC, SPLIT SCREEN!==

I am happy with this setup.

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

I think if you're happy with your setup, then stick with it. I'm generally unhappy with my emacs setup and prefer vscode; however I am definitely swimming against the current. I have recently found vscode to be pretty legit for Common Lisp due to this repo, but it's pretty new and doesn't have a lot of traction yet.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

hmm my swank and sly server closes after about 30 seconds of inactivity. This is the output.
;; swank:close-connection: end of file on #<dynamic-extent STRING-INPUT-STREAM (unavailable) from "(:emacs-...">

Any way to keep it open?
(slynk:create-server :dont-close t)
No change.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

might be doing that when a file isnt loaded... waiting out

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

hmm i started today being like im gonna really get to this and my server keeps shutting down, im reviewing your guide now.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

I'll have to try it with slynk, I've only been using swank. They could be doing something different.

Looking through swank's source, it's supposed to send a ping every so often. I've never seen it do that. Maybe slynk is actually sending it, not getting a response, and shutting it down.

I'll look into it.

The main thing I've seen cause it to shut down the connection is if something malformed gets sent to swank, which would mean the parser is doing something wrong. I wouldn't think it would wait that long, though.

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

I haven't tried it with slynk, but sly is incredibly well done. I have no idea, off the top of my head, of what might be happening.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Thanks for your help. I dont know enough to be able to identify the source of the problems myself.

I am not sure that i am having the server disconnect issue as a result of something new, such as being on ubuntu 20.10 vs windows or that I am running it long enough for it to disconnect unlike before.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Update:

reinstalled roswell since it makes access to everything pretty easy.

My prompt in terminal was '*' now its '?'

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

I don't like the way Roswell closes over my dev environment, so I've quit using it. Sorry that I am not very helpful in this regard.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

I am not setup as a project. Strictly a file.

Just the disconnect yielding:
;; swank:close-connection: Unexpected end of file on #<STRING-INPUT-STREAM :CLOSED #x302000EAD4FD>

occurs with both swank and slynk.

Is there an easy setup guide for sly?

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

I don't like the way Roswell closes over my dev environment, so I've quit using it. Sorry that I am not very helpful in this regard.

What do you mean?

I will get away from rosswell, lots going on behind the scenes I am not familiar with on it.

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

I am not setup as a project. Strictly a file.

Just the disconnect yielding:
;; swank:close-connection: Unexpected end of file on #<STRING-INPUT-STREAM :CLOSED #x302000EAD4FD>

occurs with both swank and slynk.

Is there an easy setup guide for sly?

You mean in emacs?

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

nope ur comment earlier speaking of sly.

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

I don't like the way Roswell closes over my dev environment, so I've quit using it. Sorry that I am not very helpful in this regard.

What do you mean?

I will get away from rosswell, lots going on behind the scenes I am not familiar with on it.

I prefer composable tools. I prefer to be able to swap out tools as my needs change. Roswell wraps my entire environment in a way that makes it inescapable. I have no way to configure exceptions that I might want. I have no access to the internals. Libraries and tools that use it are very hard to use if you don't also use Roswell.

I might just not be familiar enough with it, but right now I am uncomfortable with the magic.

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

nope ur comment earlier speaking of sly.

I haven't used sly outside of emacs. I'll leave my code instance open for a bit and see if mine times out.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Ah got yah. Im the same way if I know what i am doing.

I am trying the same thing letting it idle on swank.

I had two running windows running with VSC and i am wondering if that made a hickup down somewhere.

First exercise question today was to make a random number generator, in java we just used tools. I can see this course is gonna be closer to the metal than my past experiences.

Already its lasted longer without timing out.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

I cloned sly from github, ran the slynk server from there, and it just doesn't work at all. They renamed a bunch of the APIs, so it errors on almost everything. I tried connecting to the slynk server with slime from emacs and it refuses to connect to it. I should probably do the same for now.

I have not seen it timeout, though, so it might be a parser issue.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

ouch. that sucks.

So far stable with one window open. I got multiple screens i like to utilise.

Even though i ran one server, i guess two VSC instances would still message the server, even though i started it only one the one.

NOPE just closed the server connection.

When I get an error in a program, do i want to return to swank's top level?

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

I am running it in an external terminal window. Still closed its self.

Grasping at straws, what OS are you guys on?

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

I usually use the abort restart when the debugger comes up.

I bounce back and forth between Linux and windows. Which one are you using?

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Ubuntu 20.10.

Waiting for a new network adapter in the mail and will probably switch to Manjaro.

Opps i mean, i always set to swank top level. Ill try abort restart.

I am so unfamiliar with the syntax and grammar that just about everything comes up as an error.

right now im trying to return a number back from a function that does a few things but its returning the last thing and not what i want :/

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

So far stable on resetting thread, and running one VSC instance and using an external terminal window to run the server

I post fast so in case your looking into things that your not wasting time. I did say I am new!

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Can you run this is a separate terminal?

sudo tcpdump -A -i lo port 4005

When it closes the connection, see what the last thing it shows is? It should show what's being sent between the extension and swank.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Strictly when I loaded the file Ctr shift enter.

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 262144 bytes
16:32:04.437473 IP localhost.46928 > localhost.4005: Flags [P.], seq 3495853954:3495854043, ack 1623056489, win 512, options [nop,nop,TS val 369985389 ecr 369944500], length 89
E.....@[email protected]...^....i........... ...m....000053(:emacs-rex (swank:load-file "/home/tr/COMP-456/Experimental/rng.lisp") nil t 2459) 16:32:04.441150 IP localhost.4005 > localhost.46928: Flags [P.], seq 1:75, ack 89, win 663, options [nop,nop,TS val 369985393 ecr 369985389], length 74 E..~.x@.@[email protected]..i.^.......r.....
...q...m000044(:return (:ok "#P"/home/tr/COMP-456/Experimental/rng.lisp"") 2459)
16:32:04.441162 IP localhost.46928 > localhost.4005: Flags [.], ack 75, win 512, options [nop,nop,TS val 369985393 ecr 369985393], length 0
E..4..@[email protected]...^..........(..... ...q...q 16:32:04.460266 IP localhost.46928 > localhost.4005: Flags [P.], seq 89:152, ack 75, win 512, options [nop,nop,TS val 369985412 ecr 369985393], length 63 E..s..@[email protected]...^..........g.....
.......q000039(:emacs-rex (swank:list-all-package-names t ) nil t 2460)
16:32:04.461032 IP localhost.4005 > localhost.46928: Flags [P.], seq 75:1709, ack 152, win 663, options [nop,nop,TS val 369985412 ecr 369985412], length 1634
E....y@.@.:............P....^............. ........00065C(:return (:ok ("SWANK-IO-PACKAGE" "SWANK/GRAY" "CROSS-REFERENCE" "XREF" "SWANK/CCL" "SWANK-MONITOR" "SWANK" "SWANK-MOP" "SWANK/MATCH" "SWANK/RPC" "SWANK/BACKEND" "SWANK-BACKEND" "SWANK-LOADER" "ROSWELL.UTIL" "QL-SBCL" "QL-MKCL" "QL-ECL" "QL-LISPWORKS" "QL-SCL" "QL-CMUCL" "QL-CLISP" "QL-CLASP" "QL-CCL" "QL-ABCL" "QL-ALLEGRO" "QUICKLISP-CLIENT" "QUICKLISP" "QL" "QL-BUNDLE" "QL-DIST-USER" "QL-DIST" "QL-CDB" "QL-GUNZIPPER" "QL-MINITAR" "QL-HTTP" "QL-PROGRESS" "QL-NETWORK" "QL-IMPL-UTIL" "QL-IMPL" "QL-CONFIG" "QL-UTIL" "QL-INFO" "ASDF/FOOTER" "ASDF/USER" "ASDF-USER" "ASDF/INTERFACE" "ASDF-UTILITIES" "ASDF" "ASDF/BACKWARD-INTERFACE" "ASDF/BACKWARD-INTERNALS" "ASDF/SOURCE-REGISTRY" "ASDF/OUTPUT-TRANSLATIONS" "ASDF/PACKAGE-INFERRED-SYSTEM" "ASDF/CONCATENATE-SOURCE" "ASDF/BUNDLE" "ASDF/PARSE-DEFSYSTEM" "ASDF/DEFSYSTEM" "ASDF/FIND-SYSTEM" "ASDF/OPERATE" "ASDF/PLAN" "ASDF/FORCING" "ASDF/FIND-COMPONENT" "ASDF/LISP-ACTION" "ASDF/ACTION" "ASDF-ACTION" "ASDF/SYSTEM-REGISTRY" "ASDF/SYSTEM" "ASDF/OPERATION" "ASDF/COMPONENT" "ASDF/SESSION" "ASDF/UPGRADE" "UIOP/DRIVER" "ASDF/DRIVER" "UIOP" "UIOP/BACKWARD-DRIVER" "UIOP/CONFIGURATION" "UIOP/RUN-PROGRAM" "ASDF/RUN-PROGRAM" "UIOP/LAUNCH-PROGRAM" "UIOP/LISP-BUILD" "ASDF/LISP-BUILD" "UIOP/IMAGE" "UIOP/STREAM" "UIOP/FILESYSTEM" "UIOP/PATHNAME" "ASDF/PATHNAME" "UIOP/OS" "UIOP/VERSION" "UIOP/UTILITY" "UIOP/COMMON-LISP" "UOIP/CL" "UIOP/PACKAGE" "QL-SETUP" "ROSWELL" "ROS" "COMMON-LISP-USER" "CL-USER" "OPENMCL-SOCKET" "OPENMCL-MOP" "ANSI-LOOP" "|SwinkIO/0|" "SWINK" "INSPECTOR" "ARCH" "X86" "X8632" "GRAY" "COMMON-LISP" "CL" "CCL" "KEYWORD" "X8664" "TARGET" "X86-LINUX64" "OS")) 2460) 16:32:04.461052 IP localhost.46928 > localhost.4005: Flags [.], ack 1709, win 512, options [nop,nop,TS val 369985412 ecr 369985412], length 0 E..4..@[email protected]...^..........(.....
........

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

its maintained a stable connection for awhile. I dont know what changed other than applying the placebo of trying random things.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

I think you want this.

16:35:40.451884 IP localhost.46928 > localhost.4005: Flags [.], ack 2085, win 510, options [nop,nop,TS val 370201403 ecr 370201403], length 0
E..4..@[email protected]...^.a`........(.....
...;...;

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Function:
Arglist: (VAR &OPTIONAL (VALUE NIL VALUE-P) DOC)

Define a global variable at top level. Declare the variable
SPECIAL and, optionally, initialize it. If the variable already has a
value, the old value is not clobbered. The third argument is an optional
documentation string for the variable.") 2461)
16:35:40.451884 IP localhost.46928 > localhost.4005: Flags [.], ack 2085, win 510, options [nop,nop,TS val 370201403 ecr 370201403], length 0
E..4..@[email protected]...^.a........(..... ...;...; 16:36:26.232766 IP localhost.46928 > localhost.4005: Flags [P.], seq 223:292, ack 2085, win 512, options [nop,nop,TS val 370247184 ecr 370201403], length 69 E..y..@[email protected]...^.a........m.....
.......;00003f(:emacs-rex (swank:documentation-symbol "SEED") CL-USER t 2462)
16:36:26.233333 IP localhost.4005 > localhost.46928: Flags [P.], seq 2085:2165, ack 292, win 663, options [nop,nop,TS val 370247185 ecr 370247184], length 80
E....{@.@[email protected]`....^.......x.....
........00004A(:return (:ok "Documentation for the symbol SEED:

Not documented.") 2462)
16:36:26.233341 IP localhost.46928 > localhost.4005: Flags [.], ack 2165, win 512, options [nop,nop,TS val 370247185 ecr 370247185], length 0
E..4..@[email protected]...^..........(..... ........ 16:36:26.838668 IP localhost.46928 > localhost.4005: Flags [P.], seq 292:360, ack 2165, win 512, options [nop,nop,TS val 370247790 ecr 370247185], length 68 E..x..@[email protected]...^..........l.....
...n....00003e(:emacs-rex (swank:documentation-symbol "INC") CL-USER t 2463)
16:36:26.839301 IP localhost.4005 > localhost.46928: Flags [P.], seq 2165:2244, ack 360, win 663, options [nop,nop,TS val 370247791 ecr 370247790], length 79
E....|@.@[email protected]`....^.......w.....
...o...n000049(:return (:ok "Documentation for the symbol INC:

Not documented.") 2463)
16:36:26.839310 IP localhost.46928 > localhost.4005: Flags [.], ack 2244, win 512, options [nop,nop,TS val 370247791 ecr 370247791], length 0
E..4..@[email protected]...^....,.....(..... ...o...o 16:36:28.311881 IP localhost.46928 > localhost.4005: Flags [P.], seq 360:427, ack 2244, win 512, options [nop,nop,TS val 370249263 ecr 370247791], length 67 E..w..@[email protected]...^....,.....k.....
.../...o00003d(:emacs-rex (swank:documentation-symbol "N2") CL-USER t 2464)
16:36:28.312781 IP localhost.4005 > localhost.46928: Flags [P.], seq 2244:2322, ack 427, win 663, options [nop,nop,TS val 370249264 ecr 370249263], length 78
E....}@.@[email protected]`..,.^.-.....v.....
...0.../000048(:return (:ok "Documentation for the symbol N2:

Not documented.") 2464)
16:36:28.312800 IP localhost.46928 > localhost.4005: Flags [.], ack 2322, win 512, options [nop,nop,TS val 370249264 ecr 370249264], length 0
E..4..@[email protected]...^.-`..z.....(.....
...0...0

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

last two and this were idle.

Not documented.") 2468)
16:37:39.132364 IP localhost.46928 > localhost.4005: Flags [.], ack 2644, win 512, options [nop,nop,TS val 370320084 ecr 370320084], length 0
E..4..@[email protected]...^.C........(..... ........ 16:37:49.894337 IP localhost.46928 > localhost.4005: Flags [P.], seq 705:855, ack 2644, win 512, options [nop,nop,TS val 370330846 ecr 370320084], length 150 E.....@[email protected]...^.C..............
........000090(:emacs-rex (swank:documentation-symbol "#'(lambda ()
(ash (setf seed (mod (+ (* 214013 seed) 2531011) (expt 2 31))) -16))") CL-USER t 2469)
16:37:49.895087 IP localhost.4005 > localhost.46928: Flags [P.], seq 2644:2775, ack 855, win 671, options [nop,nop,TS val 370330846 ecr 370330846], length 131
E.....@.@[email protected]....^............. ........00007D(:return (:ok "No such symbol, #'(lambda () (ash (setf seed (mod (+ (* 214013 seed) 2531011) (expt 2 31))) -16)).") 2469) 16:37:49.895096 IP localhost.46928 > localhost.4005: Flags [.], ack 2775, win 511, options [nop,nop,TS val 370330846 ecr 370330846], length 0 E..4..@[email protected]...^....?.....(.....
........

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

I'm trying to see what command it's sending that swank is giving an EOF error on. It'll be one of the (:emacs-rex ...) lines. Is swank still giving this error?

;; swank:close-connection: Unexpected end of file on #<STRING-INPUT-STREAM :CLOSED #x302000EAD4FD>

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Well, not one of. It should be the last emacs-rex before the connection is closed.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

not for the past 30 minutes. I have not had to restart and reconnect Alive.

When I can keep it running and when it happens again send you that dump.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Ok, sounds good.

My current theory is that there was something in your code that the parser was screwing up on and it was sending invalid code to swank for evaluation. I probably need better defensive coding around what I send to it.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

This is outside the scope of your projecture Alive,

(defvar inc 0)

(defun avg (n1 n2 n3)
(= inc 2)
(/ (+ n1 n2 n3) 3)
)

reutrns the average but when I have

(defun avg (n1 n2 n3)
(/ (+ n1 n2 n3) 3)
(= inc 2)
)

returns the comparison.

So ( ... ) pars of equal depth, is the last one returned in a function?

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Ok, sounds good.

My current theory is that there was something in your code that the parser was screwing up on and it was sending invalid code to swank for evaluation. I probably need better defensive coding around what I send to it.

Your theory is probably very right.

To add I think i triggered the exact same event in portacle that we are facing now, with your integration, and this environment, we can actually see an error.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Lisp uses implicit returns, so the last thing evaluated in a body is the return value. That's true for loops, if statements, functions, everything.

If you have a function

(defun foo (x y)
x
y)

It'll return y because that's the last thing in the body.

(if t
(progn 1 2 3)
5)

Returns 3. T is true, so the first form is evaluated. The last thing evaluated in the progn body is the number 3, so that's returned.

You can kind of get around that by using the prog1 and prog2 macros. They return the first or second thing evaluated instead of the last. So,

(defun foo (x y)
(prog1 x y))

Returns x and

(defun foo (x y)
(prog2 x y 4 5 6))

Returns y. There's also (return ...) and (return-from ...) that can be used for early returns.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Saw it in my book and wanted to try it.

When I input the REPL: (append ‘(1 2) ‘(3 4))

Instant crash yielding output:

.1...0..000055(:emacs-rex (swank:interactive-eval "(append ...(1 2) ...(3 4))") COMMON-LISP-USER t 977)
17:10:49.980255 IP localhost.4005 > localhost.48452: Flags [F.], seq 209187, ack 74630, win 512, options [nop,nop,TS val 372310932 ecr 372310929], length 0
E..4..@.@..,...........D9H-.b..y.....(.....
.1...1..
17:10:49.980330 IP localhost.48452 > localhost.4005: Flags [F.], seq 74630, ack 209188, win 512, options [nop,nop,TS val 372310932 ecr 372310932], length 0
E..42N@.@.
t.........D..b..y9H-......(.....
.1...1..
17:10:49.980343 IP localhost.4005 > localhost.48452: Flags [.], ack 74631, win 512, options [nop,nop,TS val 372310932 ecr 372310932], length 0
E..4..@.@..+...........D9H-.b..z.....(.....
.1...1..

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Did you copy it from the book? It looks like it might be using a unicode character for the apostrophe.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

(defun foo (x y)
(prog1 x y))

Returns x and

(defun foo (x y)
(prog2 x y 4 5 6))

cool. thanks. I needed that. that helps a lot.

hahaa yup i coped it from the book. I would have never guessed that. You saved me a few hours of questioning reality.

The book is normally copy protected, using a text reader in here made it copyable.

I think i am on starting to get on my feet now in lisp.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

If you want me to stop spamming your page about my issues, feel free to let me know.

How does one pass a list of an arbitrary length to a function?

One of many attempts.

in file:
(defun list-eater (list ll) )

in REPL:
(list-eater (1 2 3) )

Also how do i pass letters to a function, when i tread things like numbers i am told that they are undefined.

Thanks.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

oh dear, nm.

i think i solved my problem with '

(list-eater '(1 2 3) )
on
(defun list-eater (ll) ).

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

That's one way. Just remember that if the list you pass in has variables, the quote won't work right. To pass the variable values you'd need to use (list x y) instead of '(x y).

The other way is with a &rest parameter. That'll turn the arguments into a list for you.

(defun foo (&rest r) (format nil "~A" r))
(let ((x 5) (y 10)) (foo x y))

=> "(5 10)"

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Okay Ill wrestle with trying that out tomorrow.

last one for tonight.

REPL:
(wtf 5 '(5 1 2) )

(defun wtf (ele lis)
(if (= ele (nth 0 lis))
(write 'FOUND-IT)
(write '2222222222))
(write 'DIDNT-FIND-IT)
)

Always evaluates to false and outputs didnt find it.

But when I type everything in REPL with a different name, it can evaluate to true.

Thoughts?

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

It'll always print didnt-find-it because that's after the if statement. If you want either part of the if to have multiple steps, they need to be wrapped in a progn.

(if (= ele (nth 0 lis))
(write 'FOUND-IT)
(progn
(write 'DIDNT-FIND-IT)
(write '2222222222))
)

The fact that typing everything with a different name works suggests the function isn't getting re-evaluated and it's running an old copy.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

facepalm

So I got use to firing up the servers through the terminal. Yesterday in our troubleshooting, i moved to the terminal window but neglected to read its output.

Many times functions are returning null in REPL when in terminal they are achieving the intended results.
gosh iam new.

Quicklisp or clisp is suggested for the course, In the spirit of structuring code for a marker, would someone would normally be looking at the terminal window correct? I want to be sure things are output the same way as someone would read it and I'am confident our setup is more advanced than the one used by the course evaluators.

from alive.

smashedtoatoms avatar smashedtoatoms commented on July 19, 2024

I've done this before. Don't feel bad. When you're in the repl, the functions will return the last statement evaluated in the function, and that is what you'll see in the repl. If you use the format function though, it writes to stdout (terminal) as a side-effect, and the function returns NIL (that behavior can be modified). If you're writing an application that someone will use from the terminal, you'll likely want to output to stdout with a format command because they won't be using the repl. Does that answer your question?

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Absolutely. Thanks.

from alive.

nobody-famous avatar nobody-famous commented on July 19, 2024

Only other thing I'd add is that stdin is also still attached to the terminal, so if your program tries to read from the keyboard it'll need to be through the terminal as well.

from alive.

cooleynal avatar cooleynal commented on July 19, 2024

Thanks Ill remember this.

Noone posts on the course forums and sometimes I need a little bump to see what my roadblock is.

I appreciate having someone to talk to. Feeling quite claustrophobic as i am not confident in expressing things in lisp yet. I am very excited to see this homoiconicity when it comes up, but first babysteps.

from alive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.