[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]
4chanarchives logo
Lisp General: Reader Macros Are Cool
Images are sometimes not shown due to bandwidth/network issues. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 52
Thread images: 6
File: Space-cadet.jpg (1 MB, 2001x773) Image search: [iqdb] [SauceNao] [Google]
1 MB, 2001x773
This is the Lisp General, ask any and all Lisp questions here. Below is a link to the general's pastebin which contains many links to various books, documentation, websites, and other interesting information.
Check the pastebin first:             Read the FAQ:
http://pastebin.com/u/g-lisp-general http://pastebin.com/aDfDm5sZ

>Here's the /g/ wiki's page on Lisp:

>To foster discussion:
Which dialect do you prefer?
Do you use Emacs or a different lisp-based editor?
What was your first experience with lisp?
What have you made in lisp?
What is your favorite Lisp program?
What do you like about Lisp?
How do you think Lisp is (one of) the superior programming language(s)?
How long have you been programming in Lisp?
What are your favorite Lisp resources? Please share, preferably links!
Is Lisp your main programming language or not? Regardless, what do you primarily use it for?
What would you like to see in the Lisp general?
What was your favorite aspect of the Lisp machines?
Do you think we'll ever get something similar to the LispMs again?
What is your preferred method of documenting your code?
In the dialects that allow it, do you make many reader macros or not?
Do you use more than one dialect? What are they and which do you prefer?
What do you consider the criteria for what constitutes a Lisp to be?
What is your favorite function in your chosen dialect(s)?
The previous thread:

How neat. I've been wanting to do something similar with the Common Lisp pretty printing system for a while.
I should really start on that.
Who knew Racket had a manifesto?


> The creation of a programming language calls for guiding principles that point the developers to goals. This article spells out the three basic principles behind the 20-year development of Racket.

> First, programming is about stating and solving problems, and this activity normally takes place in a context with its own language of discourse; good programmers ought to formulate this language as a programming language. Hence, Racket is a programming language for creating new programming languages.

> Second, by following this language-oriented approach to programming, systems become multi-lingual collections of interconnected components. Each language and component must be able to protect its specific invariants. In support, Racket offers protection mechanisms to implement a full language spectrum, from C-level bit manipulation to soundly typed extensions.

> Third, because Racket considers programming as problem solving in the correct language, Racket also turns extra-linguistic mechanisms into linguistic constructs, especially mechanisms for managing resources and projects.

So you can have JSON literals in Lisp.
edn master race.
The more I read about racket, the cooler it seems.
Programming languages are compiler-human interfaces, a language that allows defining sublanguages is a massive sidestep and explains why Racket is still in obscurity after two fucking decades.
Not every language has to be popular. Racket has its niche, and it's doing fine.
well the thing is Racket isn't 20 years old, it used to be scheme until a few years ago.
I can't remember when it started to grow from a simple and regular Scheme implementation to really solid language with a good and sizable standard library
I wrote this for a different thread. See if you can improve it.
(defun stars ()
(loop with number-list
for input = (progn (princ "Input a number (blank to exit): ")
for number = (parse-integer input :junk-allowed t)
when (zerop (length input))
do (return)
when (not (null number))
when (member number number-list :test #'=)
do (format t "You've already entered that number.~%")
do (format t "~v@{*~}~%" number nil) (push number number-list)))

All it does is read a number from the user and prints out that many asterisks. Any number previously entered is not to be printed again.
(defun asterisks (n seen)
(flet ((get-next ()
(parse-integer (read-line) :junk-allowed t)))
(cond ((member n seen)
(format t "Number has already been seen;~%")
(asterisks (get-next) seen))
(format t "~{~D~}~%" (loop :repeat n
:collect #\*))
(asterisks (get-next) (cons n seen))))))

Just for fun.
Is it possible to write a /lispg/ thread bumping program?
We've already discussed this. I'm not paying for a 4chan pass.

I think we have enough people by now who can bump it and have something cool to show us at the same time.
>muh 50 year old language
you're using a 50 year old language too
I recall reading some stuff about concurrency that mentioned that conses were holding Lisp back. I'm only a casual Lisp user, but I thought about it and thought it was pretty accurate. While conses are interesting conceptually, you don't actually need them in a Lisp implementation, and cons, car, cdr, cadr, etc. can be simplified with first, rest, nth.

My question is, for those of you who breathe Lisp, what would you say is the most fundamental aspect of Lisp?

I would say lists and homoiconicity. If you have those, then you have unambiguous syntax and the ability to use eval and macros freely.
do you have a link to that material? i'm always up for more reading
I'm not sure that's an improvement, but it's certainly different.

It's nice to see how people solve problems in different ways.

I suppose mine could be improved by changing the first two lines to:
(defun stars (&optional (number-list ()))
(mapc (lambda (x) (or (integerp x) (error "The stars list can only contain integers."))) number-list)
(loop with number-list = number-list

He was probably talking about this:


Things to Avoid

DO loops.
linear linked list. (lisp's cons)
Java style iterator.
even arrays are suspect.
as soon as you say “first, SUM = 0” you are hosed.
accumulators are BAD. They encourage sequential dependence and tempt you to use non-associative updates.
If you say, “process sub-problems in order,” you lose.
The great tricks of the sequential past WON'T WORK.
The programing idioms that have become second nature to us as everyday tools for the last 50 years WON'T WORK.

Well fuck
> lists things to avoid
> doesn't present a way around it
Gee, thanks, Guy!
The text is written by Xah Lee and it's about Steele's lecture
I didn't have time to watch the lecture. But if Steele had given good alternatives (apart from using languages whose keywords I can't type), don't you think Xah Lee would have mentioned them?
this list of books is interesting, even if you don't really care about Clojure, since the list was made by Rich Hickey, apparently these were the books that influenced him.
fuck forgot the list
i'm just going to comment on the books i read from that list:

>Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp by Peter Norvig
a classic, recommend

>The Art of the Metaobject Protocol by Daniel G. Bobrow
also a classic. but unless you're interessted in MOP skip this for now

> Purely Functional Data Structures by Chris Okasaki
amortize functional data structures via lazyness. good book, but you can probably skip this one for now

>ML for the Working Programmer, 2nd Edition by Lawrence C. Paulson
nice if you're into ML. these days i would probably pick ocaml though.
Functional Approach to Programming - Guy Cousineau comes to mind

>Artificial Intelligence: A Modern Approach (2nd Edition) by Stuart J. Russell
also a classic, recommend

>Essentials of Programming Languages - 2nd Edition by Daniel P. Friedman
basicly SICP part 2. the 2nd edition is hard to get and people complain about 3rd. be warned

>On Lisp: Advanced Techniques for Common Lisp by Paul Graham
classic text. maybe a bit dated.

>ANSI Common LISP by Paul Graham
okay-ish. probalby skip

>Programming in Prolog: Using the ISO Standard by W. F. Clocksin
good intro for prolog. i prefer:
The Art of Prolog: Advanced Programming Techniques - Leon Sterling, Ehud Shapiro and pair that with
Natural Language Processing for PROLOG Programmers
- Michael A. Covington and build your own watson

>Concepts, Techniques, and Models of Computer Programming by Peter Van-Roy
neat book. complement with harpers practical foundations for programming languages

> Structure and Interpretation of Computer Programs, Second Edition by Harold Abelson
have you read your SICP today???

>Object-Oriented Programming in COMMON LISP: A Programmer's Guide to CLOS by Sonya E. Keene
good to decent intro for CLOS

>How to Solve It: A New Aspect of Mathematical Method (Princeton Science Library) by G. Polya
also a classic, recommend
>>ANSI Common LISP by Paul Graham
>okay-ish. probalby skip
Also; keep in mind:

He tried.

File: hammock.jpg (72 KB, 500x500) Image search: [iqdb] [SauceNao] [Google]
72 KB, 500x500

Item 40 is cute.
> Hammock Driven Development
I'm going through How to Design Programs and ran into a strange problem/question.

From Section III, Abstraction:
>Can we hope to define
, which determines whether two functions from numbers to numbers are equal f? If so, define the function. If not, explain why and consider the implication that you have encountered the first easily definable idea for which you cannot define a function.

The solution I found was:
; Function1 Function2 Num.MAX Num.MIN -> Boolean
(define (function=? func1 func2 top bot)
[(< top bot) true]
[else (and (= (func1 top) (func2 top))
(function=? func1 func2 (sub1 top) bot))]))

Which gives the appropriate true/false values for function one being
(+  a 3)
and function two being
(+  (- a 3) 6)
, as well as for the same function one and function two being
(+ a (abs a) 3)
for ranges 10 to 1 (true for the first examples) and 3 to -3 (false for the second example, because they're only equal for positive input and not all input).

However, the way that paragraph is phrased makes me feel like there wasn't supposed to be a solution, which means the one I found was wrong. Did I mess something up or am I just misinterpreting?
It's possible if functions are total (always terminate) and the domain is finite.
Ugh, sorry about that awful quoting, I didn't know code tags broke it.

I see, thank you.
File: 500004885-03-01.jpg (45 KB, 600x450) Image search: [iqdb] [SauceNao] [Google]
45 KB, 600x450
Why aren't Lisp machines still a thing?

Seriously. If I was a millionaire, i would pour tonnes of cash into developing a modern Lisp machine architecture.
Can you run SBCL on your x86?
Congrats you have a LISP machine.
Lisp machines are like Laserdisc players. Y'all keep comparing them to VHS when we have Blu-Ray now.
I think it's exciting that the old knowledge won't be as useful.
Not really.
Not him, but modern UNIX systems don't compare at all.

Also, Laserdisc may have been analog, but you can't even play Blu-Rays without jumping through hoops to avoid DRM or giving into all of the restrictions, which actually makes it a pretty good analogy, since Blu-Ray is locked down shit and that's the path computers are headed down.
File: wut.jpg (21 KB, 411x334) Image search: [iqdb] [SauceNao] [Google]
21 KB, 411x334
>linear linked list. (lisp's cons)
What do you think it is? Were you going to be pedantic and say it's a node in a list?

No, just that it's included in the "Things to avoid" list.
the elements are not in contiguous memory
I didn't read the book, but I can immediately give you an example of two functions that deliver the same results at all inputs (which is what you check for) but can still not be considered equal.
(define (f1 x)
(+ x 1))
(define (f2 x)
(set! *some-global* x)
(+ x 1))

Unless of course the book assumes that only pure functions are used (which would be pretty naive).
The book hasn't touched on assignment yet.
CLIM is actually awesome
GUI toolkits? Without needing to cram shit into an event loop?
Is the scrolling pane bugged in macclim?
What benefits would Lisp machines provide over the status quo at this point in history?
I haven't noticed anything as such.
is there anything like quicklisp for guile?
JSON is a sublanguage.
PCRE is a sublanguage.
The C preprocessor is a sublanguage.
Massive sidesteps all?
How do you build lists without consing, whether directly or under the hood?
>parallel computing gotchas
i doubt anyone here does much that requires massive low-level parallelism
if you want to play with it, probably a good bet would be the connection machine simulator, which lets you run their massively parallel lisp dialect without needing an actual CM2+LispM:
good luck getting it running, there's probably readmes out there somewhere
Best answer I've seen to the "what would today's Lisp machine be like" question. Today's Lisp machine would be exactly like SBCL. No, it doesn't run on the metal, but neither does anything else these days, and it's a blazing-fast and highly complete Common Lisp implementation. Why quibble?

I mean, I remember back when we were all fighting to get Open Genera running in emulation, none more so than Emunon, who was me. (Hello again.) Eventually I was just like, you know what? Fuck it. I remember back when I was a kid and it took endless dicking around to get anything interesting to happen with any computer more complex than an Apple IIe. Back when I was a kid, I had the patience for shit like downloading entire disk sets to install Slackware 3.4 on a Toshiba brick laptop with less processing power than a modern pacemaker, not to mention that back when I was a kid, that was the only option. I no longer have such patience. Happily for me, modern hardware and software makes amazing capabilities trivially easy to obtain, so I no longer have to put up with a ton of silly bullshit in order to start doing something that actually interests me. There's enormous value in such simplicity, which should not be overlooked.

Maybe you feel as though you were born too late, that there's no way to live up to the trailblazing pioneer heroes of days gone by. Well, there isn't, and in some ways that's a shame. But on the other hand, those trailblazing pioneer heroes did what they did so that those who came behind -- namely us -- wouldn't have to put up with buckskin tents and bathing once a month, and while it's fun to play with old things, eventually it just gets wasteful of time we could instead be spending on doing something really cool with the utterly fantastic tools of today.
Thread replies: 52
Thread images: 6
Thread DB ID: 52285

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.
If a post contains personal/copyrighted/illegal content you can contact me at wtabusse@gmail.com with that post and thread number and it will be removed as soon as possible.