freenode/#lisp - IRC Chatlog
Search
10:17:59
TMA
phoe: JEE is tricky because of all the nested classloaders isolating everything from everything else; the clojure folks made an awesome remote repl called nREPL for clojure. I am not sure, but it could probably be ported to ABCL so that the client need not be rewritten
13:05:57
jmercouris
there are some things in my directory that I'd rather not have to recreate is all
13:06:40
jmercouris
I was playing around with sbcl yesterday, and I "installed" quicklisp in sbcl, and that has made some issues for CCL I believe
13:07:12
Shinmera
That doesn't sound right. Multiple implementations can use the same quicklisp directory.
13:07:52
jmercouris
I'm not sure exactly why that is, possibly because I did a dist update while in sbcl, then went back to ccl
13:13:22
jackdaniel
right now they are warnings, but nobody knows what they will be in next asdf version
13:20:22
pjb
jmercouris: there are actually at least two circumstances when you load your system: 1- you load your system to compile and check it while developping and testing it. 2- you load your system to use it.
13:21:15
pjb
jmercouris: even in the second case, it may be useful to have warnings, because the developers may have loaded on some version of some implementation and found no errors and no warning, but then you're using it in a new version or another implementation, and those warning could matter a lot.
13:22:10
pjb
jmercouris: if ArianeEspace engineers had had a warning about the Ariane3 module loaded into the Ariane5 system that used a different type of lateral acceleration, they would have saved a rocket and 2 satellites!
13:23:24
jmercouris
pjb: Right yeah, I don't have issues with warnings, it's just that on my own system at least, I'd hope that the warnings don't exist
13:31:50
beach
This is how Second Climacs computes the indentation for LOCALLY http://metamodular.com/locally.png
13:47:25
jmercouris
beach: basically depending on how deep you are in the indentation/nest it'll color boxes to the gutter
13:47:38
jmercouris
so a 1st level indentation might be red, second might be green, and so on and so forth
13:49:20
beach
Sounds like a great project for someone who would like to make a contribution. But it must wait until I have more infrastructure available.
13:51:59
jmercouris
and definitely, you don't want to have to build out every possible theoretical extension
13:52:32
jmercouris
in some ways are projects are very similar and very different, obviously our approaches and technologies are radically different, but we are both trying to build platforms
13:56:01
phoe
If yes, then you can take (mod depth 6) and style each paren according to one of six colors. Boom, rainbow parens.
13:56:49
beach
Probably. I don't much like to emphasize parentheses myself, but it could be another contributed project.
13:59:11
jmercouris
phoe: if all people were really similar, and all needs could be met with a single editor, then likely a dominant paradigm would emerge
13:59:53
phoe
it emerged, it's called an Integrated Development Environment and it's used for languages like C or Java or C#.
14:01:32
beach
jmercouris: You seem to think that people make decisions because they are rational. They aren't.
14:01:57
jmercouris
yes, that's definitely true, otherwise I wouldn't have picked up lisp, or a browser project
14:31:09
pjb
It would be more useful to colorize the parentheses according to their interpretation by the evaluator: operator application (3 kinds), code syntax, data.
14:39:57
pjb
and then, with enough colour, we could also distinguish accessors from normal functions.
14:54:01
comborico1611
Hello. I'm interested in learning Lisp, but I'd like to see how a certain simple program would work in Lisp. The program converts an input of seconds into Years Days Hours Minutes Seconds.
14:56:51
jmercouris
I wonder what happened with that other guy pjb was helping, did he pass his assignment?
14:59:01
beach
comborico1611: I think I am with loke here. If your purpose is really to learn Common Lisp, then ask some specific questions, and we will answer.
15:00:33
jmercouris
alternatively, describe what you think the steps should be to convert your input to your desired result
15:00:49
comborico1611
Beach, I'm wanting to see this little program *before* i decide to learn the language. But if i have no takers, i will attempt to write it, then come back to see if i did it in a concise manner
15:00:52
Bike
https://pastebin.com/DgpGhrbp i don't think this is very informative about how lisp works
15:04:34
comborico1611
Beach, you suggest i don't learn it because i want to see an example of code first? (I think i found the grumpy one of the group.). Your name is quite fitting.
15:05:00
jmercouris
comborico1611: I don't think it's that, it just seems very much like fishing for a homework problem
15:05:18
jmercouris
comborico1611: If you really wanted to learn the language you'd be willing to look at just about any example of any type as long as it teaches something about the language
15:05:51
jmercouris
comborico1611: unless you presume that you can predict which kinds of functions will be the most illustrative of the langauges techniques and strengths without knowing the language
15:05:59
comborico1611
If i suspect this particular problem is well-suited to demonstrate the aspects of a language, I would prefer to use that one program as an example. Not just any program.
15:07:09
comborico1611
If the person has a limited amount of knowledge in programming, but his work with one program, namely the seconds program, then that program example is best for them to understand other languages, without investing time in learning the language first.
15:07:20
Bike
i'm not sure what would be informative as to the nature of the language, but i don't think this is it
15:07:41
jmercouris
comborico1611: let's start with a different approach, what is your motivation for learning programming languages, and what would you hope to get out of learning lisp?
15:07:41
beach
comborico1611: You can take our collective word for it. Common Lisp is worth learning.
15:07:58
_death
comborico1611: this channel is not to convince people to learn lisp, it's for people already interested in lisp
15:08:51
comborico1611
Bike, with your understanding of programming, you are correct this wouldn't be a good demonstration of the nature of the language. But with someone with limited knowledge working on the same sample code that they've done in other languages, is the appropriate choice.
15:09:03
pjb
comborico1611: it's not a question of knowing lisp or even programming. It's a question of having brains, and booting it.
15:09:55
comborico1611
Pjb, I've written the code in another language. I just don't want to take the time to read a few chapters in a book to just see the sample code.
15:10:29
White_Flame
comborico1611: this is like a C programmer asking how you get the length of a string in Python, but not wanting to use the builtin
15:10:46
comborico1611
Beach, I'm very aware that lisp is a great programming language. I am a die-hard Emacs user. I'll be at not good enough to use the customization that elisp provides..
15:11:31
beach
comborico1611: Oh, you want to learn Emacs Lisp. Wrong channel. This one is dedicated to Common Lisp.
15:12:17
pjb
comborico1611: for a quick intro, have a look at http://clisp.hg.sourceforge.net/hgweb/clisp/clisp/raw-file/tip/doc/LISP-tutorial.txt or http://www.franz.com/resources/educational_resources/cooper.book.pdf
15:12:30
jmercouris
and it's tailor made for an obsolete instruction set on an experimental chip from the 60s
15:12:47
comborico1611
Beach, no no. I'm looking for common lisp. I know lisp is the most powerful language. And cl the most powerful dialect.
15:13:50
comborico1611
Jmercouris, thanks. I'm using voice recognition. But i appreciate the thoughtfulness.
15:13:57
pjb
comborico1611: if you want an example of a lisp program, have a look at https://gitlab.common-lisp.net/gsharp/gsharp
15:14:54
comborico1611
It would be more useful if I saw an example of a program I've worked with. And I've only work with one program in my life. A program that converts seconds in 2 years months days hours minutes seconds.
15:15:32
jmercouris
comborico1611: you make it sound like you've been toiling your whole life on this one program, I imagine it is the best seconds converter in the world
15:15:41
pjb
comborico1611: also, I'd be curious about my adjective. Feel free to identify the seven dwarfs ;-)
15:16:34
jmercouris
"I've only worked on one program my whole life, but this one, let me tell you, this is the fastest, most lightweight seconds to date converter ver"
15:17:18
White_Flame
comborico1611: I would suggest simply learning Common Lisp. Forget your date example. You don't really have the grounding yet to make comparison evaluations; learn Lisp to at least get that foundation established
15:18:25
jmercouris
There is one good thing about learning lisp as your first language, none of the terms will confuse you
15:18:59
comborico1611
True. I've read OO what's in a name. I didn't understand most of it, but i liked it.
15:19:48
jmercouris
why did you keep reading a book if you didn't understand it? and how did you like it if you didn't understand it?
15:22:45
jmercouris
pjb: the problem is, we don't have enough Grumpy spots for all the people on #lisp
15:22:50
White_Flame
comborico1611: it's a very clever solution that has a generic numeric breakdown that can take any list of modulos
15:23:15
pjb
comborico1611: it was written more than 10 years ago, and it is used to generate the code of Babylonian or Aztec number systems too.
15:24:26
pjb
More recently, of Indian's since they use strange grouping of tens for their big numbers (1000 100 100 100 …)
15:24:42
White_Flame
so you could plug in 100 at the end of the list and add centuries to your breakdown, for example
15:25:33
comborico1611_
jmercouris, that is insane. I'm glad you mentioned that. I doubt my request needs every aspect of that code then.
15:26:06
comborico1611_
Then I'll show you code. Oh wwait. I'm not acomputer. So I can just show you the code.
15:28:57
White_Flame
I'd still repeat that you'd be way better off simply going through Lisp tutorials and not focus in on something like this.
15:32:08
comborico1611
Something wrong with computer. Rebooting. Can't remember password. All i have at the moment is a functional version.
15:33:44
comborico1611
It is a shame how many programming languages have borrowed from Lisp, and don't give it credit.
15:36:23
comborico1611_
This is the functional version -- not my preferred one. I'm nt even sure this one works.
15:36:57
comborico1611_
Still trying to rmember stupid ghitjp password -- just let me have a simple password
15:39:51
comborico1611_
Here is proper seconds program, I believe. https://gist.github.com/COMBORICO
15:43:14
comborico1611_
It should be very easy to write up in Lisp. I'd just like to see it in Lisp for myself, without having to read a few chapters more than I have already.
15:45:39
beach
I usually help people when I think it might be a good investment, i.e. that the person I help will later contribute to the common code base. I don't have that impression in this case.
15:46:15
White_Flame
again, just go do some basic lisp tutorials, and you'll have enough to figure this out on your own. Or, start using the builtin decode time function
15:46:29
comborico1611_
beach, that's fine. I don't claim that I would do that. Just a guy looking to see a sample of this code in this language.
15:46:33
jmercouris
comborico1611_: What are you asking for exactly? if you want to learn lisp, just learn it, if you encounter issues in the path of learning we can help
15:47:08
jmercouris
comborico1611_: don't just ask people to randomly write up functions for your amusement, have some respect for people's time
15:47:15
comborico1611_
jmercouris, again for the fifth or more time. I'm just looking to see a sample code of how this task would be done in CL.
15:48:04
comborico1611_
jmercouris, asking for a simple program to be written by someone affluent in a language doesn't seem disrespectful of someone's time.
15:48:11
White_Flame
Lisp doesn't look like other languages, so whatever introduction you've had before isn't going to help you read Lisp
15:48:29
jmercouris
yes it totally does, because you are ignoring what everyone is telling you, that it is a waste of time
15:48:42
White_Flame
comborico1611: there are already tons of resources to help you learn. You're trying to bypass them for no defensible reason
15:48:43
jackdaniel
this looks very much like you have an assignment from uni (or wherever) and you think that you will "outsmart" people on lisp by asking them to write it for you (with some improbable excuse)
15:49:51
comborico1611_
This is terribly simple code. I just want to see a sample of it, inspect how I feel the language is reflected by the code *before* I commit time to learning a language.
15:50:33
jmercouris
I don't speak for everyone here, but I think I have a good pulse of what many are thinking
15:50:38
White_Flame
"show me written Chinese before I learn the language, and I'll use that to decide whether or not I want to learn it, because there's a lot I can intuit from it"
15:50:56
comborico1611_
jmercouris, you have a reading comprehension problem. I detailed before the reason I preferred this specific example.
15:51:17
jmercouris
I don't have a reading problem, you simply don't know how to program in any langauge, so I don't see how that would help you even if it were true
15:51:20
White_Flame
you've see multiple examples, you've seen multiple tutorials. your question repetition is pointing that somethign else is wrong
15:51:29
comborico1611_
jmercouris says "you are ignoring what everyone is telling you". sounds like you rpresent everyone
15:51:57
comborico1611_
jmercouris, you hurt my feelings. I'm not able to program blah blah blah lanague blah blah. I'm done with you, loser.
15:52:22
jackdaniel
actually he assessed your attitude based on your reactions to what others do (he didn't mention "others" internal motives / feelings)
15:52:37
jmercouris
comborico1611_: I don't think hurting your feelings makes me a loser, but that's not what I'm after, I'm just trying to help, maybe I did the wrong approach, sorry for that
15:53:45
pjb
comborico1611_: the first macro generated a function that looped over the bases list; instead, the new solution expand to the truncate calls like Bike's solution.
15:54:41
White_Flame
and just to be clear, pjb's solutions are advanced. So if you want to see examples of "real" lisp beyond just hardcoded toy examples, there you go
15:55:12
comborico1611_
Bike, thanks for your help! I found your code. Whew. I think he did in less than 3 minutes. Cry babies not wanting to demonstrate some code. Gee wiz.
15:56:08
White_Flame
well, that's one way to admit that you can't read code yet, given the number of links that have been posted. Again, go through tutorials to learn how to read the code if you want specifics
15:59:40
pjb
Notice however, that both the standard decode-universal-time and my macro and functions take and generate the list in the least-significant first order. Since lists can grow unbounded, that let the code know the meaning of the first elements of the list without having to compute its length.
16:01:22
comborico1611_
pjb, it's difficult for me to follow. But I do have a question. I have read that using macros un-needlessly (meaning unless you are forced) is considered a violation of best practices. Do you agree with this?
16:02:32
pjb
comborico1611_: you may find it funny, but both my code and _death are really demonstrating the strong points of lisp.
16:03:38
pjb
comborico1611_: If you wondered why you should learn lisp, you got the perfect answers.
16:04:41
Bike
i was not. don't impugn my motives. i did what i was asked, while saying i didn't think it was a good question.
16:05:01
jackdaniel
Bike: pjb and _death have fun with him (well deserved I suppose despite the fact I don't find such toying funny at all)
16:05:52
Bike
that's why i said the actually this has been the channel for an hour so i'll just come back later
16:05:56
jmercouris
I'm certainly pro-humor, as long as it isn't at the detriment of someone else, and I don't think _death's is evil natured or anything
16:06:08
comborico1611_
Now everyone go get some coffee. I need to study these codes. Thank you all who particpated.
16:06:24
pjb
jackdaniel: _death and my answer demonstrate meta programming, which is the strong point of lisp. My answer demonstrate a macro that generalize the problem statement so you can use it with Aztec or Babylonian number systems; _death demonstrate a general technique (the "inteprreter" pattern as the GoF puts it).
16:07:41
jackdaniel
however if you read into it, it is not obvious who is trolling who. maybe it is a self-driven vicious cycle.
16:08:48
jmercouris
at the end of the day, it doesn't matter who was trolling who, it was an interesting journey, and in some ways pretty informative, I'm actually trying to understand _death's code
16:11:56
jmercouris
_death: so each cond line basically covers a case, first one empty program, second one a number, and then whatever operands are supported, right?
16:13:05
_death
jmercouris: yes.. a better name for the function is EVAL... you may find similar functions in various Lisp books :)
16:13:25
jmercouris
_death: I get the gist of your snippet, I couldn't write something so elegant, but I could make a very clunky version I think
16:14:00
jmercouris
also "elegant" because of course it assumes a lot and isn't really extendable, but it is nice and compact
16:16:35
pjb
jmercouris: the hint is the use of progv, which is specifically designed to implement interpreters :-)
16:18:03
pjb
White_Flame: but codeshare is designed for collaborative editing and development; there's a videochat module.
16:20:56
jmercouris
If two people ssh on to the same machine, and that machine is running emacs daemon, and they both launch an instance to a file, can they both see that file being edited?
16:24:16
jmercouris
I believe sbcl complains when you don't use defgeneric, but in practice, is it bad?
16:24:44
pjb
jmercouris: there are advantages of doing them. On the other hand, it's a bore for accessors.
16:25:04
pjb
The main advantage, is that it allows you to document the generic function; also you can provide a default method.
16:25:15
_death
if you think in terms of protocols then you generally want to write defgenerics anyway
16:25:51
pjb
And since this allows you to explicitely define and document the protocol, you can easily export it from a package. So there's no problem when several different package define methods to the same generic function.
16:25:54
jmercouris
writing a set of defgenerics is effectively defining a protocol for objects of a class
16:27:10
jmercouris
or rather, a possible purpose, I'm not sure I have the whole picture yet, but yeah
16:28:14
pjb
jmercouris: for example, since methods are not attached to classes but to the generic function, it make sense often to just define them with the :method option of defgeneric. Keeping all the methods in the generic function, instead of spreading them all over the project.
16:30:32
beach
These days I even stick a DEFGENERIC in there for slot accessors. If I don't, the default signature has OBJECT as the name of the parameter, but I often want something more specific.
16:32:24
comborico1611_
Thank pjb and _death for your time. When bike gets back, tell him I bless him in the name of Jesus Christ.
16:33:23
White_Flame
comborico1611: besides this weird exchange we've had here, you should probably ask further learning questions in #clnoobs
16:34:17
comborico1611_
I've saved the programs, not to use as a homework assignment, but to meditate on. As I stated earlier, I know Lisp is the most powerful progrmming lanugage.
16:35:50
White_Flame
(that's still like meditating on a foreign language text, instead of meditating on the instructional materials to learn the language)
16:37:05
comborico1611_
And I adore Emacs. My main career is in Web Development and design. I have an interest in programming, but I'm not sure if I'm *that* intested. I only have Saturdays to dedicate to programming, when I do decide to dedicate it to learning programming. So that is why I requested a sample of this particular program. I don't wish to dedicate my free Saturdays to learning just to see a sample code. I thank this channel again fo
16:37:40
comborico1611_
Yes, I know. But it speaks to the verbosity of a given language and other generalities.
16:38:09
White_Flame
lisp can collapse code size compared to other languages, even if it can be larger in small examples
16:38:28
White_Flame
again, you need context to evaluate any of this. You're on the path to cargo cult
16:48:05
pjb
phoe: however in practice, since there's array-total-size-limit (which may be as low as 1024), the practical limit on dimensions is on the order of 10 in the worst case.
16:48:43
pjb
phoe: also, you have to consider call-arguments-limit. You couldn't index an array with that many dimensions (aref takes the array itself as first argument).
16:49:28
pjb
(you could still use array-row-major-aref, but what would be the point of declaring a multidimentionnal array if you can't index it directly).
16:49:54
pjb
So (1- call-arguments-limit) being as low as 49, this could be the lowest maximum array dimension.
16:50:13
scymtym
did anybody see what _death said? also, array-total-size-limit is not relevant in (make-array (make-list 1000 :initial-element 0))
16:53:43
pjb
Yes, that's funny, but Since there's no constraint on array-rank-limit vs. call-arguments-limit, you could have problems :-)
17:40:27
beach
This is how Second Climacs computes the indentation of TAGBODY: http://metamodular.com/tagbody.png compare to what Emacs does.
17:42:46
beach
By now, you should be convinced that the technique that I use is superior to regular expressions for indentation, right?
17:44:40
jmercouris
if I have a method like this (defmethod run-something ((args))) and then I have (defmethod run-something :before ((args))), am I correct in thinking that the method with :before will be invoked before the other?
17:45:47
specbot
Standard Method Combination: http://www.lispworks.com/reference/HyperSpec/Body/07_ffb.htm
17:46:13
jmercouris
I'd prefer something a little lighter than the CLHS, but I'll take a look, thanks
17:48:36
phoe
beach: you could also define some generic "ways" of indenting stuff. You could introduce a thing like &tagbody that is only for defining indentation and otherwise equivalent to &body, but will indent the body forms in a TAGBODY style.
17:50:55
beach
phoe: I considered that and decided against it. It is more complicated than that, because I need to know whether sub-expressions are forms or not. The recursive indentation calculation depends on it.
17:53:44
phoe
Can I define a method for (eql 'cl:do) that will turn its indentation into something tagbodylike?
18:04:11
jmercouris
now that I am starting to get into it, I am seeing what kind of a monumental task this is
18:04:28
jmercouris
especially because I am simultaneously converting the interface to a CLOS object to allow for multiple simultaneous backends
18:04:43
jmercouris
a lot of pain for now, but potentially unbeleivably cool stuff if the implementation actually works
18:05:13
jmercouris
I can imagine a single server running multiple backends on peoples computers, that would be interesting, multiple people with the same "tabs" open, stuff like that
18:20:20
sjl
the stuff said while you were away but your IRC client was connected, which you usually have to "scroll back" to see
18:22:20
whoman
<victim_> jmercouris, you hurt my feelings. I'm not able to program blah blah blah lanague blah blah. I'm done with you, loser.
18:28:02
whoman
i can't find the name of it, but it had special buttons for editing forms and such, a bit like 'touch paredit' , quite experimental. i searched but i cannot remember the name
18:28:03
fourier
APL is the best lang for the phone. Dyalog is working on their version for Android, and J already has a version for Android
18:30:18
whoman
fourier, i think if it were more visual, for eg.: https://joelkuiper.eu/assets/knowledge/lisp-edit.png
18:30:24
jackdaniel
fourier: CL also has repl and editor on android - this doesn't mean it is usable for actual programming
18:30:55
whoman
touch screen is *soooo* beautiful for scrolling and zooming. mouse wheel and keyboard cant compare with that
18:31:12
fourier
jackdaniel: as i said cl is too verbose, apl would really suite well as it is extremely terse
18:32:21
whoman
verbose in text form -- but we could visualize the trees of forms, getting to the verbotic symbol names as necessary
18:34:47
pjb
beach: We would want the expr to align on one column, and the tags to align on their own column.
18:35:16
pjb
beach: I can imagine several kinds of tagbody where writing the tags at the end of the line would be the right thing to do…
18:37:39
pjb
beach: perhaps more seriously, (tagbody tag (expr1) \n longer-tag (expr2) very-long-tag (expr3) final-tag)
18:43:57
beach
It's an impossible requirement. Imagine (tagbody tag1 statment1 <newline> statment2 tag2)
18:44:25
beach
I'll look at it tomorrow. Now I will go spend time with my (admittedly small) family.
18:47:31
Fare
He had a point-free APL optimizing compiler from APL to C++ in ~100 lines of APL (plus C++ headers and runtime).
18:49:05
Lycurgus
the failure was the IBMer contending that he could implement some function, a simple transcendental iirc, quickly, which he could not
18:55:33
fourier
Aaron is former schemer btw. he told on one conference that APL is the only language he was not able to express in scheme
18:57:36
ecraven
I learned some, but haven't really "groked" it well enough to read even simple programs
18:59:33
ecraven
APL finally made me understand that succinctness can be a virtue.. arcfide's compiler on a few pages is just really impressive, and the claim that you can actually keep it all in your head is indeed believable in that context
19:13:16
ecraven
hehe, "...in the simplest manner imaginable" is a quote I wouldn't apply to APL and the co-dfns compiler myself :P
19:21:27
fourier
strangely enough these 2 communities - apl and cl - almost never intersecting. the CL community grows from mature software engineers and science(around AI back in the day), while APL from domain experts and non-programmers
19:26:11
fourier
hm the stance "if its compiles, it most certainly works" sounds appealing, I guess some lispers (like peter siebel iirc) have switched to haskell
19:28:45
stacksmith
I am strangely attracted to this: https://en.wikipedia.org/wiki/APL_(programming_language)#/media/File:APL-keybd2.svg. Do APLers actually remember which key stands for what?
19:28:59
phoe
It worked indeed, except it did not do what I wanted it to do, so I can't say that it "worked".
19:30:33
fourier
stacksmith: yep its not that many of them. also for example in Dyalog APL IDE there is a toolbar with all the symbols so you can just point your mouse and get a hint on it. In GNU APL Emacs's mode there is a popup keyboard with a similar hint when you move mouse over the symbols.
19:31:58
stacksmith
It depends on how you define 'works'. Someone here has written gobs of Lisp code he claims "works", but he doesn't know basic things about Lisp.
19:33:25
pjb
Check the google talk, and read the Formal Analysis of the Remote Agent Before and After Flight.
19:33:46
fourier
pjb: I guess main limitation is the necessity to have a phd in category theory in order to write hello world
19:34:48
pjb
fourier: well, not really, since like in any language you're not forced to use very part of the language to write programs.
19:36:22
pjb
It is possible that eventually haskell become useful. When it will run on formally verified hardware, on which would run formally verified operating systems and drivers, and where all the libraries and network protocols you'd use would have be formally verified. Then perhaps…
19:37:17
pjb
But the main objection I see is that businesses won't finance such development in your life time (they didn't in mine). So don't dream.
19:37:29
fourier
pjb: not really. there is a pandoc which is quite widely used; other apps will come
19:40:03
fourier
there are a few jobs for haskellers; and their activity in reddit for example is higher than in lisp reddit
19:47:59
pjb
Activity in forums is proportional to the difficulties of the language or system. It's not a good sign.
20:55:38
makomo
what would be the best way to create a function from a body of code? i.e. i have a list of forms and want to make a function that will run these forms?
20:56:54
makomo
hm i guess that's doable too, and then i could create a lambda which just calls the one defined by flet/labels
20:58:13
White_Flame
if you have the expressions as list-based data, it will have to end up as EVAL or COMPILE
20:58:26
makomo
from what i can tell, FUNCTION is out of the game because it's a special operator and then i would have to eval it myself (which i suppose flet/labels, etc. do under the hood)
20:59:17
pjb
it depends on the expressions. If they are all function calls, then you can do (mapcar (lambda (x) (apply (first x) (rest x))) '((+ 1 2 3) (* 3 4 5))) #| --> (6 60) |#
20:59:42
pjb
but if you also have macros or special operators, then (compile nil `(lambda () ,@body)) is better.
21:02:40
pjb
Also, it may depend on how you want to handle errors, notably program-errors. With compile if there's a program error, nothing will be called. On the other hand you may do (mapcar (lambda (x) (ignore-errors (funcall (compile nil `(lambda () ,x))))) '((print (+ 1 2 3)) (print (/ 0)) (print 'hi))) #| 6 hi --> (6 nil hi) |#
21:07:51
pjb
makomo: also you have to consider that there are no variables linking your expressions. Perhaps you want some? Why do you have such isolated expressions? Perhaps you want to scan them for free variables and bind them in a surrounding let, so that you can have ((setf foo 42) (+ foo 3)) ?
21:09:19
makomo
pjb: what i'm trying to do is to see how exactly i would implement a small HDL/hardware simulator in lisp. it has already been done in C++ by writing a compiler and a vm, but i'm interested to see how easy it would be in lisp
21:09:37
makomo
so the first thing to do is to come up with some macros to define the hardware components and behavioral processes and such
21:09:54
makomo
and these processes would just contain lisp code which i would stuff into lambdas and store within these component objects
21:11:20
makomo
in this case, since everything is known at compile-time i can just generate lambda expressions myself without using COMPILE
21:12:45
makomo
this code contained within the processes can technically be arbitrary lisp code but should only contain operators which are related to the simulation
21:12:57
White_Flame
you only need to deal with eval/compile if you're loading in code at runtime. Everything else should be doable at macro-time
21:14:37
makomo
if i want to be safe against people putting arbitrary/nasty code into these processes, i would have to first preprocess this code before putting it into a lambda right? i would have to somehow walk the code and allow only simulation-related operators
21:15:45
White_Flame
plus, if you're concerned about reading untrusted code, you need to ensure reader eval macros are not enabled
21:15:49
makomo
well, since it's just arbitrary lisp code, it could contain nasty stuff like "rm -rf /"
21:16:34
makomo
if i had a sandbox, rather than having to check the code myself, this sandbox would only provide simulation-related operators and everything else would be unbound/undefined
21:21:28
makomo
hm i was thinking of running the code in a different package or something, but the code could always just use IN-PACKAGE to switch back i guess?
22:00:37
stacksmith
Does anyone know if vectors of 4-bit unsigned-byte values are handled efficiently by modern implementations?